*
The moose likes Servlets 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
JavaRanch » Java Forums » Java » Servlets
Bookmark "Calling an EJB bean from JSP" Watch "Calling an EJB bean from JSP" New topic
Author

Calling an EJB bean from JSP

Muthuvel Chinnachamy
Ranch Hand

Joined: Jun 13, 2001
Posts: 31
Dear All,
Can anyone help me how to call EJB bean deployed on Weblogic server from JSP. Actually the idea is to acccess the EJB bean thro Web Browser.
Thanks in advance
Muthuvel C.
Mayoor Patil
Greenhorn

Joined: Jun 18, 2001
Posts: 1
After creating an instance of your bean. Either put this bean in the session or set the attribute in the request and then you will be able to use this bean in your jsp.
------------------
vikinsa
Ranch Hand

Joined: Apr 18, 2001
Posts: 46
Originally posted by Muthuvel Chinnachamy:
Dear All,
Can anyone help me how to call EJB bean deployed on Weblogic server from JSP. Actually the idea is to acccess the EJB bean thro Web Browser.
Thanks in advance
Muthuvel C.


Vikas Aggarwal<BR>Technology Associate<BR>http://www.vikinsa.com
vikinsa
Ranch Hand

Joined: Apr 18, 2001
Posts: 46
You will have to first include the bean that is going to used in that JSP. I am giving an example here. I had prepared a package which contains all of the Beans.
Just add this line with all of the other imports.
<%@ page import = "user.*" %>
"user in my case was the name of that package".
Get the initial context..
InitialContext ctx = (InitialContext)EVUtil2.getInitialContext();
Look up the home..
user.RegisterUserHome regUserHome = (user.RegisterUserHome)ctx.lookup("RegisterUserHome");
Create the remote..
RegisterUser regUser = regUserHome.create() ;
Get the data from the method present in that bean
VectormemGroups = regUser.MemberGroups(OrgID, userId);
(Here MemberGroups(OrgID, userId) is one of my methods defined in that bean and expects two inputs OrgID, userId and returns memGroups vector.)
Show the information...
use the returned data type to show information.

Enjoy.
Originally posted by Muthuvel Chinnachamy:
Dear All,
Can anyone help me how to call EJB bean deployed on Weblogic server from JSP. Actually the idea is to acccess the EJB bean thro Web Browser.
Thanks in advance
Muthuvel C.


------------------
Vikas Aggarwal
Technology Associate
http://www.vikinsa.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling an EJB bean from JSP
 
Similar Threads
Getting a session variable in stateless session bean
As i am drawing sequence diagram for prepare itinerary...
Web Services for EJB Session Beans
MVC
calling ejb from jsp