Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling an EJB bean from JSP

 
Yugandhar Naidu
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I deployed an EJB in WebLogic5.1 and Configured the property file of the weblogic to support JSP and I created a JSP file and plased it in the dir c:\weblogic\myserver\public_html. then I can access it from the localhost:7001\myjsp.jsp. But if i want use that EJB in a JSP, I want Help where to place the Bean class (i am asking the compleate path)and where will it needs to put the jar file and also what will be the package i need to plase in the JSP file. Can any one help me (if possable with a sample code) Thanks in advance.
 
hanumanth reddy
Ranch Hand
Posts: 118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

update the weblogic-ejb.deploy= \
( name of your ejb bean should come here)
weblogic ejb properties section in the weblogicproperties file

the best way to call ejb is to use beans and acces the ejb instead of calling it directly

you can import the ejb packaage as you import other java pacjkages
hanumanth reddy http://www.cyberdosti.com
 
Yugandhar Naidu
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx Mr.Hanumanth Reddy, I have one doubt,
You told that the best way to call ejb is to use beans and access the ejb instead of calling it directly
I can't understand it. Can you explain me more about the above statement with an example.
Thanx in advance.
 
Vivek Viswanathan
Ranch Hand
Posts: 350
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is what you should do
Rather than calling the EJB directly from the JSP page, you should write a JavaBean that accesses the EJB this Java Bean in then called from the JSP page. That advantage of using this method is that the JSP pages that you write are isolated from the changes that may accour at the EJB tier.
You can get more infomration about such designs by looking at the J2EE Design Patterns suggested by Sun.

You can also look at the J2EE Blueprints Supplied from sun
Java(TM)
2 Platform, Enterprise Edition Blueprints


Vivek Viswanathan
SCJP2, SCJD , SCEA Part I

[This message has been edited by Vivek Viswanathan (edited June 21, 2001).]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic