• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Accessing Entity Beans by JSP client in Weblogic 6.1

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Adams and Beno�t .

I was able to do that .
------------------
Asif Equbal
Cognizant Technology Solutions , India.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic