Peter Delahunty wrote:
> Has anyone managed to sucessfull call EJB's from a JSP. My understanding is
> you need to use a JavaBean as a Proxy object (eg between the JSP and EJB)
> but i have never actually done it ... Anyway i am just interested for now
> anyone know...
You do not need anything special, attatched is an example that work fine with
WebLogic 4.5.1.
SeeU!
Title: First Example
<%
try {
javatips.examples.FirstExample example= null;
example= (javatips.examples.FirstExample)session.getValue("beans.example");
if (example == null) {
java.util.Hashtable initialContextParams= new java.util.Hashtable();
initialContextParams.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
initialContextParams.put(javax.naming.Context.PROVIDER_URL, "t3://"+request.getServerName()+":"+request.getServerPort()+"/");
javax.naming.Context context= new javax.naming.InitialContext(initialContextParams);
javatips.examples.FirstExampleHome home= (javatips.examples.FirstExampleHome)context.lookup("examples.FirstExampleHome");
example= home.create();
session.putValue("beans.example", example);
}
%>
Appel de getGreetings
<%= example.getGreetings() %>
<%
} catch (Exception e) {
}
%>