• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Calling an EJB bean from JSP

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
------------------
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.


 
vikinsa
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
To do a great right, do a little wrong - shakepeare. twisted little ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic