File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Calling an EJB bean from JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Calling an EJB bean from JSP" Watch "Calling an EJB bean from JSP" New topic
Author

Calling an EJB bean from JSP

Yugandhar Naidu
Greenhorn

Joined: Jun 19, 2001
Posts: 3
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

Joined: Jun 12, 2000
Posts: 118

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


<a href="http://www.jobklub.com" target="_blank" rel="nofollow">http://www.jobklub.com</a><br /> 'Add Job To Life'
Yugandhar Naidu
Greenhorn

Joined: Jun 19, 2001
Posts: 3
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

Joined: Mar 03, 2001
Posts: 350
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).]


Vivek Viswanathan SCJP 1.2, SCJP 1.6,SCJD,SCEA,SCWCD,IBM-484,IBM-486,IBM-141,Ms.NET C# 70-316,SCMAD, LPIC-I
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling an EJB bean from JSP