wood burning stoves*
The moose likes BEA/Weblogic and the fly likes Accessing Entity Beans by JSP client in Weblogic 6.1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Accessing Entity Beans by JSP client in Weblogic 6.1" Watch "Accessing Entity Beans by JSP client in Weblogic 6.1" New topic
Author

Accessing Entity Beans by JSP client in Weblogic 6.1

Asif Equbal
Greenhorn

Joined: Dec 10, 2001
Posts: 7
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.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Moving this to the WebLogic forum.
------------------
Tom
Sun Certified Programmer for the Java� 2 Platform
Moderator of the forums:
J2EE and EJB
Other Java APIs


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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
Adam Adams
Ranch Hand

Joined: Nov 28, 2001
Posts: 60
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

Asif Equbal
Greenhorn

Joined: Dec 10, 2001
Posts: 7
Thanks Adams and Beno�t .

I was able to do that .
------------------
Asif Equbal
Cognizant Technology Solutions , India.
 
 
subject: Accessing Entity Beans by JSP client in Weblogic 6.1