• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Accessing EJBs from JSP

 
Ranch Hand
Posts: 289
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am wondering how I can access an EJB from a jsp page. I have an EJB (Entity) that I can execute from an application client. I want to create a web client for it, in the form of JSP.But I am wondering what I should do to execute the EJB in the jsp page.
Herbert.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Herbert,
One way of doing this is to have a servlet in between to execute the EJB and transfer the results to the JSP. The servlet will be invoked by the JSP and the servlet shall contain the necessary coding for invoking the EJB and the result can be displayed with JSP again.
Regards,
Anand Srinivas
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, it is a REALLY BAD idea to directly access an Entity bean from any kind of client -- Java Application, Servlet, or JSP. You need to wrap your Entity EJB access in a Session Facade.
See this article. Not only do the arguments there apply, but also, each access to an Entity bean (every getter) that is not wrapped in a client transaction (which is also a bad idea) is a new transaction, which results in at least one SQL call....
Kyle
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic