📄 cartwebimpl.java
字号:
package apusic.myshop.cart.web;import javax.servlet.http.HttpSession;import java.rmi.RemoteException;import apusic.myshop.control.GeneralFailureException;import apusic.myshop.control.web.ModelUpdateListener;import apusic.myshop.control.web.ModelManager;import apusic.myshop.cart.ejb.Cart;import apusic.myshop.util.JNDINames;import apusic.myshop.cart.model.CartModel;public class CartWebImpl extends CartModel implements ModelUpdateListener { private ModelManager mm; private Cart cartEjb; public CartWebImpl() { super(null); } public void init(HttpSession session) { // initializing super class with a null list. This means that // if because of some bug, this object gets referenced // (typically in the JSP page) before performUpdate is called, // a null pointer exception will get thrown. this.mm = (ModelManager)session.getAttribute("modelManager"); mm.addListener(JNDINames.CART_EJBHOME, this); } public void performUpdate() { // Get data from the EJB if (cartEjb == null) { cartEjb = mm.getCartEJB(); } try { copy(cartEjb.getDetails()); } catch (RemoteException re) { throw new GeneralFailureException(re); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -