Attached is a JSP version of the earlier "Tutorial: Servlets with JOnAS"
post. Hopefully, it might help people looking for a JSP to EJB sample.
Does anyone have a JSP <--> Bean <--> EJB sample?
-Todd
Title: JSP Example
<%
try {
eb.Account acc = null;
// probably should be moved to an include file
java.util.Hashtable initialContextParams = new java.util.Hashtable();
initialContextParams.put("java.naming.factory.initial", "com.sun.jndi.rmi.registry.RegistryContextFactory");
initialContextParams.put("java.naming.provider.url", "rmi://10.12.23.188:1099");
javax.naming.Context context = new javax.naming.InitialContext(initialContextParams);
// or lookup AccountExplHome
eb.AccountHome home = (eb.AccountHome)context.lookup("AccountImplHome");
Enumeration alist = home.findAllAccounts();
%>
ACCOUNT LIST
|
NUM
|
NAME
|
BALANCE
|
<% while (alist.hasMoreElements()) {
acc = (eb.Account) alist.nextElement();
%>
|
<%= acc.getNumber() %>
|
<%= acc.getCustomer() %>
|
<%= acc.getBalance() %>
|
<% }
} catch (Exception e) { %>
<%= e%>
<% } %>