customerwebimpl.java
来自「一个优秀的供应商管理系统」· Java 代码 · 共 50 行
JAVA
50 行
package apusic.myshop.customer.web;import java.rmi.RemoteException;import apusic.myshop.control.GeneralFailureException;import apusic.myshop.customer.model.CustomerModel;import apusic.myshop.control.web.ModelUpdateListener;import apusic.myshop.control.web.ModelManager;import apusic.myshop.customer.ejb.Customer;import apusic.myshop.util.JNDINames;//观察者public class CustomerWebImpl extends CustomerModel implements ModelUpdateListener {//主题 private ModelManager mm;//顾客实体 private Customer custEjb;//构造函数初始化 public CustomerWebImpl() { // This bean should created by the request processor System.out.println("CustomerWebImpl: This bean should not be instanciated from a JSP"); }//初始化观察者并添加到主题中 public CustomerWebImpl(ModelManager mm) { super(null, null, null, null, null, null, null, null, null, null, null, null, null); this.mm = mm; mm.addListener(JNDINames.CUSTOMER_EJBHOME, this); }//观察者更新自己 public void performUpdate() { // Get data from the EJB if (custEjb == null) { custEjb = mm.getCustomerEJB(); } try { if (custEjb != null) copy(custEjb.getDetails()); } catch (RemoteException re) { throw new GeneralFailureException(re); } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?