com.wrox.store.ejb.cart.Cart 这个有问题
解决方案 »
- 有关exe4j的问题,求大神帮忙!!!
- 什么情况下使用缓存?
- 难题: 如何实现类似QQ消息的收发方式?
- 我是JTable里一个单元格嵌套的JCheckBox
- 关于Servlet的404错误
- ajax用POST方法提交的数据,如何取出来?
- 高分相求,jsp邮件系统 发邮箱[email protected]
- log4j,dom4j,jstl是什么东西来的,有什么作用,就直接引用就可以了吗?不用修改的吗??具体说来是干吗的,不是很懂的...
- 更新问题,求救!SOS
- socket连接中使用ObjectInputStream类传送对象流
- 讨论一下Petstore,你的学习方式是怎样的?
- 想请大家帮我设置一下环境变量
<%@ include file="header.jsp" %><P>
Access the EJBs :
<UL>
<LI>In a <A HREF="catalog.jsp?catalogPage=scriptlet.jsp">scriptlet</A></LI>
<LI>Through a <A HREF="catalog.jsp?catalogPage=bean.jsp">JavaBean wrapper</A></LI>
<LI>Using <A HREF="catalog.jsp?catalogPage=tag.jsp">custom tags (1)</A></LI>
<LI>Using <A HREF="catalog.jsp?catalogPage=jndi.jsp">custom tags (2)</A></LI>
</UL>
</P><%@ include file="footer.jsp" %>我把第一句注释后,页面可以显示,很明显,是第一句引入文件的问题
header.jsp内容如下:
<%-- find the user's cart that is bound to the HTTP sesison --%>
<jsp:useBean id="cart" class="com.wrox.store.ejb.cart.Cart" scope="session"/><HTML>
<HEAD>
<TITLE>Wrox on-line store</TITLE>
</HEAD><BODY><P>
<H1>Wrox on-line store</H1>
</P>显然是第一句的问题,Cart是session bean的远程接口,内容如下:
package com.wrox.store.ejb.cart;import java.rmi.RemoteException;
import java.util.*;import com.wrox.store.ejb.customer.Customer;
import com.wrox.store.ejb.product.Product;
import com.wrox.store.exception.*;/**
* This represents the business interface for a shopping cart in
* our on-line store.
*
* @author Simon Brown
*/
public interface Cart extends javax.ejb.EJBObject { /**
* Adds the specified quantity of the supplied product to the cart.
*
* @param product the Product to be added to the cart
* @param newQuantity the quantity of the product to be added
*/
public void add(Product product, int newQuantity)
throws RemoteException; /**
* Gets a reference to the collection of products in the cart.
*
* @return a Collection of Product instances (or references)
*/
public Collection getProducts() throws RemoteException; /**
* Determines how many of the specified product are in the cart - if any.
*
* @param product the Product to find
* @return an int representing the quantity in the cart
*/
public int getQuantity(Product product)
throws RemoteException; /**
* Gets the total price for this order.
*
* @return a double representing the total price
*/
public double getTotal() throws RemoteException; /**
* Submits the contents of this cart to be purchased. This involves a number
* of steps including :
* <OL>
* <LI>authorising the credit card</LI>
* <LI>sending a message to the fulfillment centre</LI>
* <LI>sending a confirmation e-mail to the customer</LI>
* </OL>
*
* @param customer the Customer that this cart belongs to
* @throws AuthorizationException if the credit card details were
* incorrect or authorization was not given
*/
public void submitOrder(Customer customer)
throws AuthorizationException, RemoteException;}还提供了CartBean和home接口CartHome
描述符ejb-jar.xml片段如下:
<session>
<ejb-name>Cart</ejb-name>
<home>com.wrox.store.ejb.cart.CartHome</home>
<remote>com.wrox.store.ejb.cart.Cart</remote>
<ejb-class>com.wrox.store.ejb.cart.CartBean</ejb-class> <session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
</session>我是EJB初学者,按我的理解,错误提示说明是com.wrox.store.ejb.cart.Cart实例化的时候出问题了,也就是这句<jsp:useBean id="cart" class="com.wrox.store.ejb.cart.Cart" scope="session"/>
我不明白,Cart是个接口,怎么能够被实例化呢,还有这里只提供了home接口没有类,谁来实现它呢?EJB的运作方式是通过home接口调用远程接口,继而调用EJB吗,到底是怎么实现的?盼赐教!