Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using servlets with EJB

 
Vipul Shinde
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can any one tell me how can I use a EJB(Entity/Session) in a servelt.

If I want to use it in any of request methods i.e. doGet , doPost how should I work with it ?
 
Satish Chilukuri
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can any one tell me how can I use a EJB(Entity/Session) in a servelt.


Have you worked with EJBs before? If yes then the answer would be to use them in the same way. (Look up the Home, create a bean etc..). If you haven't, the question is related to EJBs and not to servlets and you might consider going through some EJB tutorials and use the EJB forum if you have any doubts.
 
Keith Pitty
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your servlet would need to act as a client to the EJB.

Briefly, it would need to use JNDI to locate the EJB, then use the EJB's Home interface to create an EJB bean instance before invoking methods on that instance via the EJB's Remote instance.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic