• Post Reply Bookmark Topic Watch Topic
  • New Topic

Very Basic Question in EJb  RSS feed

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This may be very basic question but...
Definition of ejb bj ed-roman says that..
"An ejb ia a server-side software component that can be deployed in a distributed multitier environment"
Now servlets is also a server-side component then what;s the difference in ejb.
(I know that container provides services to ejb...transaction ,persistence, security....)
and what is mean by "can be deployed in a distributed multitier environment"
------------
prashant
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IMO one major difference is the divergence from simple request/response semantics. Unlike Servlets(having a single point of entry), EJBs can expose business methods and hence they are true "business components".
And then you have inbuilt transaction support, instance pooling, lifecycle management and other such goodies...
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
methods can be invoked remotely on distributed environment which is not possible with servlets.
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A very good question though it is a basic one. As others also pointed out EJBs are true distributed objects which has lots of facilities provided by the container where as a Servlet is just an entry point to the web container.
But I think what you are asking is, Why EJBs when Servlets are there ?. If this is your question you are talking about most commonly asked EJB question. For most of the applications (As far as I believe) EJBs are not needed or at least the use of EJBs cannot be justified(interms of money and complexity). But there are some applications which needs transactions management like services and for such projects use of EJBs can be justified.
 
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are a number of reasons EJBs might be useful in your architecture: They have the services of the container going for them: security, transactions, scalability, container managed persistence (arguably a good or a bad thing) etc. As mentioned before, they make meaningful methods available, not just "run this servlet". They can support CORBA, JMS and other protocols. I got all that today from the first day of a refresher EJB class.

Many of those requirements show up in high end systems only, and plenty of high capacity sites and apps have been built wihout em for sure.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!