EJBs provide a nice architecture for writing server side components. If
reusability is one of your design goals, then this is a very attractive
option. EJB uses the concept of container and component. The container
provides the basic infrastructure for developing large scale
applications - transactions, persistence, security, etc. An application
server that supports EJB will also typically have support for features
like connection pooling, thread pooling, etc.
If you develop all your business logic in the servlets and the servlet
container (webserver or the servlet engine) does not have support for
these features, then you have to spend time to develop them yourself.
With EJBs, the application developer can spend more time on developing
the application and less time to worry about middleware or system
issues.
Another reason why you would want to push the business logic to another
tier is for decoupling. Servlets are very tightly coupled to HTTP. If
your application needs to provide another interface, say XML over CORBA,
for interfacing with other backend systems, then having your business
logic in the EJBs may be attractive. In this case you can have an HTTP
adapter to your system (Servlets) and a CORBA adapter ( which takes IIOP
requests and calls EJBs in the backend).
Distribution may be another advantage. You may have all your Servlets
running on a web server farm in one tier making calls to EJBs running on
an application server farm on another tier. This way you can scale your
applications when you move from 100 hits/hour to 1 million hits/hour (:
Sorry, if I digressed from the original intent of this mailing list
(JSP).
Anirban
"ACI Team (Chennai)" wrote:
>
> hello all,
> someone was mentioning about keeping the business logic in EJB or
> SERVLET , could someone explain more about where to keep the logic to be
> efficient enough.
> i think craig was saying something about having a single servlet for
> the entire appln and that servlet routes the request to the ejb which is
> having the business logic, why can't we have the business logic in the
> servlet itself.
> please explain..
> thanx in advance.
> aciteam
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html