Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

ejb v/s servlets

Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the advantage of ejb over servlets
Posts: 11962
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's quite difficult to give a good answer to this, I think, because EJBs and Servlets are such different kind of beasts.
Enterprise JavaBeans is a component model (similar to CORBA's CCM or Microsoft's COM) and provides support for component based development, assembling an application out of components (that is, EJBs). These components (EJBs) can be developed to provide services (session beans), persistence (entity beans), asynchronous processing (message-driven beans) and all in between. Servlets on the other hand are more focused "components" -- they are only suitable for request/response processing (typically for HTTP requests but theoretically for any request/response protocol necessary).
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps a better question would be:
Q: What are the advantages of using EJB's to implement an application's business logic vs using proprietary Java classes?
A: EJB's are too cumbersome in smaller, simpler applications (i.e. EJB's are over kill in some situations).
Proprietary Java classes have less overhead since they can live in the Web container along with the presentation layer (no RMI calls are involved). They are faster in smaller applications (>300 concurrent users) where memory management is not an issue.
EJB's can service requests from multiple applications. EJB's (and their container) eliminate the need to write transaction processes. The EJB container can re-use the same objects to service multiple requests. EJB's can exist on a seperate server from their client applications.

Please discuss....
The moth suit and wings road is much more exciting than taxes. Or this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic