?? customerwebimpl.java
字號:
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;//構(gòu)造函數(shù)初始化 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); } }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -