dcsimg

How can I invoke an RMI Server from a in JSP page?

Serge Knystautas

Just about whatever you can do in a Java app, you can do in a JSP. Here's a simple JSP that calls a method on an RMI server object:

<%@ page import="java.rmi.*,myrmipackage.*" %>
<%! 
  MyRemoteObject serverobj=null ;

  public void jspInit() {
    serverobj = (MyRemoteObject)Naming.lookup
     ("rmi://localhost/myobj");

  }
%>
<%=serverobj.helloworld()%>