Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing Entity Beans by JSP client in Weblogic 6.1

 
Asif Equbal
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Adams and Beno�t .

I was able to do that .
------------------
Asif Equbal
Cognizant Technology Solutions , India.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic