jsp与ejb通信 作者:blueski 编译
以下是一个snippet代码,演示了jsp页面如何与 ejb session bean进行相互作用。
| <%@ 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... %> |
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器