I have developed an entity bean , Matrix and deployed it to the Weblogic Server 6.1 . tested with java client it is working . I would like some help as to how can i access this Ejb , Using JSP as the client . Thanks
Asif Equbal<BR>Cognizant Technology Solutions , India.
Hi Asif, You could code access to the entity bean directly from within your JSP (by doing a lookup of the JNDI name of its home interface using the InitialContext, etc), but that's not the best idea as the purpose of JSP is to provide the presentation layer. It's a bit of a bad design to put too much java code into the JSP as it breaks separation between presentation, business logic and persistance layers ;-) The recommended approach for doing this is to create a session EJB to act as an intermediary between your web application and your entity beans to isolate the persistance/storage layer from the business logic layer. Then create a normal JavaBean to access this session EJB and use this bean (jsp:useBean) from your JSP page. An alternative would be to create a tag library to replace the useBean functionality, as it is more friendly to HTML developpers. If you think it's a too big overhead for what you do, forget about the session bean and just access your entity bean from your java bean. Hope this helps, Beno�t
here is an example to how to acces your ejb: assume your ejb name is : test and it is in a package package1 <!-- %@ page language="java" import=""%> <jsp:useBean id="test" scope="page" class="package1.test" /> <HTML> <BODY BGCOLOR="white"> <H1> test</H1> <HR> <% out.println("test this interface ");
%> </BODY> </HTML>
Originally posted by Asif Equbal: I have developed an entity bean , Matrix and deployed it to the Weblogic Server 6.1 . tested with java client it is working . I would like some help as to how can i access this Ejb , Using JSP as the client . Thanks
Joined: Dec 10, 2001
Thanks Adams and Beno�t .
I was able to do that . ------------------ Asif Equbal Cognizant Technology Solutions , India.