| <%@ page import="javax.naming.*, javax.rmi.PortableRemoteObject, foo.AccountHome, foo.Account" %> <%! file://declare a "global" reference to an instance of the home interface of file://the session bean AccountHome accHome=null; public void jspInit() { file://obtain an instance of the home interface InitialContext cntxt = new InitialContext( ); Object ref= cntxt.lookup("java:comp/env/ejb/AccountEJB"); accHome = (AccountHome)PortableRemoteObject.narrow(ref,AccountHome.class); } %> <% file://instantiate the session bean Account acct = accHome.create(); file://invoke the remote methods acct.doWhatever(...); // etc etc... %> |