《J2EE企业级应用开发》一书的配套源代码

源代码在线查看: order.jsp

软件大小: 36612 K
上传用户: zhoujun008
关键词: J2EE 企业级 应用开发 源代码
下载地址: 免注册下载 普通下载 VIP

相关代码

								javax.servlet.http.*,java.rmi.*,javax.rmi.PortableRemoteObject,javax.ejb.*,com.j2eeapp.cdstore.order.*,com.j2eeapp.cdstore.vo.*" %>
									InitialContext ctx=new InitialContext();
				   
				   try
				   {
				   	
				    
				   OrderLocalHome orderHome = (OrderLocalHome)ctx.lookup("ejb/order/order");
				   OrderLocal order;
				  
				  OrderStatusLocalHome osh=(OrderStatusLocalHome)ctx.lookup("ejb/order/orderstatus");
				//OrderStatusLocal osl=osh.create(new OrderStatus("order_demo_159","order_demo_159",OrderStatusLocalHome.ORDER_STATUS_NOTCOMFIRMED));
				 OrderStatusLocal osl=osh.findByPrimaryKey("order_demo_159"); 
				/** for(int i=10;i				   {
				    	order=orderHome.create("order_demo_"+i);
				  }**/
				    
					  order= orderHome.findByPrimaryKey("order_demo_11"); 
					  order.setUserId("hellking_111");
					  order.setOrderDate(System.currentTimeMillis());
					  order.setTotalPrice(12.3f);
					 order.setCreditCard(new CreditCard("hNo.248274-324-324","dskfj",new java.util.Date()));
					  
					 order.setOrderStatus(osl);
					 
					/** LineItemLocalHome lineItemHome = (LineItemLocalHome)ctx.lookup("ejb/order/lineitem");
				    LineItemLocal lineItem=null;
				     lineItem= lineItemHome.findByPrimaryKey("item8475"); */
				     
				    /** order.addLineItem(new LineItem("lineitem105","item8479",2,566.5f));
				     order.addLineItem(new LineItem("lineitem101","item8477",3,45.55f));
				     order.addLineItem(new LineItem("lineitem102","item8478",3,45.55f));**/
				      
				      out.println("orderid#");	 
					 out.println(order.getOrderId());
					 out.println("userid$");
					 out.println(order.getUserId());
					 out.println("cardnumber$");
					 out.println(order.getCreditCard().getCardNumber());
					 out.println("orderstatus.status=");
					 out.println(order.getOrderStatus().getStatus());
					 out.println("");
					 Collection c=order.getAllItems();
					 
					 Iterator it=c.iterator();
					 while(it.hasNext())
					 {
					    LineItem li=(LineItem )it.next();
					    out.println("itemid");
					    out.println(li.getItemId());
					    out.println("lineitem.quantity");
					    out.println(li.getQuantity());
					 }
					
					}
					catch(NamingException e)
					{
					    e.printStackTrace();
					 }
					 
				
				%>
							

相关资源