• Post Reply Bookmark Topic Watch Topic
  • New Topic

accesing ejb's from jsp

 
seetarama raju
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
recently we've tried to connect to ejb interface firectly from
jsp. but it is giving a proble. please somebody let me know whether we can directly connect from jsp by writing the look up code in scriptlets or is it compulsory that we've to use a middle layer like servlets or tag libraries etc..
thanks in advance.
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EJBs can indeed be accessed directly from scriptlets within a JSP using the same code as you would normally use. One thing to make sure is that you import all of the appropriate classes using the page directive.
Of course, just because you *can* access EJBs directly from a JSP doesn't mean that you *should*. Placing logic like this mixes business and presentation logic, clutters up the page and ultimately makes it more difficult for web desigers to weave their creative magic. In this situation, a custom tag layer is a good solution and one that I would recommend.
Hope that helps...
Simon
------------------
Simon Brown
Co-author of Professional JSP 2nd Edition
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!