Java Reference
In-Depth Information
from going out of range, so there is always a welcome message returned for any integers passed into
the method.
Figure 20-1: Test output after the JSP client shown in Listing 20-5
Listing 20-5: JSP client
<%@ page import="javax.naming.*, java.rmi.*,
java_database.ch20.HelloSLBean.*" %>
<%! private static Context ctx;
// Instantiate InitialContext
static {
try {
ctx = new InitialContext();
} catch (Exception e) {
System.out.println(e);
System.out.println("Error trying to do one time initialization.");
}
}
// A utility method that output a message to browser with a line
breaker <BR>
public void toBrowser(String msg, JspWriter out) throws Exception {
out.print(msg + "<BR>");
}
// Action starts
toBrowser("Beginning client.jsp", out);
// Look up home interface
HelloEJBHome home = (HelloEJBHome)ctx.lookup("Hello");
Search WWH ::




Custom Search