<%
Properties props=new Properties();
props.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
props.setProperty("java.naming.provider.url","localhost:1099");
props.setProperty("java.naming.factory.url.pkgs","org.jboss.naming");
InitialContext ctx;
try{
ctx=new InitialContext(props);
IHelloWorld h=(IHelloWorld)ctx.lookup("HelloWorld/remote");
out.println(h.sayHello("persia."));
}
catch(NamingException e){
out.println(e.getMessage());
}
%>
记得导入相关包
import="java.util.*,javax.naming.*,com.persia.session.*"
由于与ejb在同一个容器,无需jbossClient包。
将EJB项目和web客户端部署到JBOSS即可。