📄 enterprise1bean.java~3~
字号:
package cmp2bean;import javax.ejb.*;public class Enterprise1Bean implements SessionBean { SessionContext sessionContext; public void ejbCreate() throws CreateException { /**@todo Complete this method*/ } public void ejbRemove() { /**@todo Complete this method*/ } public void ejbActivate() { /**@todo Complete this method*/ } public void ejbPassivate() { /**@todo Complete this method*/ } public void setSessionContext(SessionContext sessionContext) { this.sessionContext = sessionContext; } public void displayPerson(String last) { try { Context context = getInitialContext(); //look up jndi name Object ref = context.lookup("Contact2"); //look up jndi name and cast to Home interface contactHome = (ContactHome) PortableRemoteObject.narrow(ref, ContactHome.class); System.out.println("find a record whose key is:"+last); contact=contactHome.findByPrimaryKey(last); System.out.println("getFirst(): "+contact.getFirst()+ " getLast(): "+contact.getLast()+ " getEmail(): "+contact.getEmail()); } catch (Exception ex) { System.out.println("Exception in displayPerson in PersonHandlerBean:"+ex); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -