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

Accesing java beans vs ejb's from jsp

Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone tell the difference between accesing java beans vs accesing enterprise java beans from jsp's. Conceptually what is the difference and how does one do it...
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i've never done EJB but i know little about it. it would not be a difference due to they are JavaBeans and EJBs, but the difference would be there due the reason that they both are DIFFERENT technology.
with EJB u deal with remote objects hence u end up using JNDI for bean lookup. once u get the ref to remote bean its all same...
with JavaBeans its as simple as using any other Java object. u instantiate it and that it.
using EJB ur JSP page can use any Bean Object available within the n/w using naming resolution but with simple Beans u can access only beans on ur server.
again, u might be using EJBs from ur local Beans which is perfectly possible.
i don find any meaning in comparing the access methods u r talking about...
Saloon Keeper
Posts: 27919
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With a regular JavaBean, you can just use the "jsp:useBean" and Bob's your uncle. There's no such easy way in with EJB's - you have to do a JNDI lookup to find the bean's Home interface, then create or find using one of the home methods.
So why go to all that much trouble? Because EJBs have some useful attributes:
1. They have built-in transaction controls
2. You can use an abstract persistency mechanism instead of coding the DBMS details in application code
3. Most EJB containers provide a cache mechanism for better performance of frequently-referenced items.
4. You can provide services to multiple client machines.
5. Some EJB systems also allow clustering support, so that EJB services can be distributed for better workload balancing and failover support.
It's not uncommmon for a JavaBean to be a used as a proxy for an EJB. That way the JSP conveniences for JavaBeans can be used, and the JNDI/home ugliness is safely tucked out of sight inside the proxy JavaBean.
So it takes a day for light to pass through this glass? So this was yesterday's tiny ad?
a bit of art, as a gift, the permaculture playing cards
    Bookmark Topic Watch Topic
  • New Topic