⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 entityinheritancetest.jsp

📁 一个EJB开发实例
💻 JSP
字号:
<%@ page contentType="text/html; charset=GBK"%>
<%@ page import="com.foshanshop.ejb3.EntityInheritanceDAO,com.foshanshop.ejb3.bean.*,
				javax.naming.*, 
				java.util.Properties"%>
<%
		Properties props = new Properties();
		props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
		props.setProperty("java.naming.provider.url", "localhost:1099");
		props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");	

		InitialContext ctx = new InitialContext(props);
		try {			
		    EntityInheritanceDAO entityinheritancedao = (EntityInheritanceDAO) ctx.lookup("EntityInheritanceDAOBean/remote");			
			entityinheritancedao.initializeData();
			Vehicle vehicle = entityinheritancedao.getLastVehicle(); //取最后一个Vehicle
			out.println("Vehicle类:速度=");
			out.println(vehicle.getSpeed());

			Car car = entityinheritancedao.getLastCar(); //取最后一个Car
			out.println("<br>Car类:速度=");
			out.println(car.getSpeed()+"; 发动机="+ car.getEngine());

			Camion camion = entityinheritancedao.getLastCamion(); //取最后一个Camion
			out.println("<br>Camion类:速度=");
			out.println(camion.getSpeed()+ "; 发动机="+ camion.getEngine()+ "; 集装箱="+  camion.getContainer());
			/* 下面语句会删除所有记录
            entityinheritancedao.deleteVehicle();
			*/

		} catch (Exception e) {
			out.println(e.getMessage());
		}
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -