sdheepa wrote:

> Just look at the Foll. Architecture:
>
>    JSP File ->Contacting Servlet-> This Servlet in
> turn talks with EJB to perform bussiness logic...
>
>   What are the advantages/diadvantages of having the
> Servlet to contact the EJB..with repect to performance
> and scalability...
>
> Instead of having the servlet contact the EJB why not
> we have the Java Bean talk to the EJB..
>
> ie  what problems we might face if  the architecture is
> like this:
> JSP File ->Contacting Java Bean-> This Bean in turn
> talks with EJB to perform bussiness logic...
>

The issue I have with this approach is not performance or scalability -- there
will not be any significant differences here, because (as many have pointed out)
JSPs get turned in to servlets anyway.  Rather, what I am concerned about is
maintainability and code re-use.

Using a JSP-Bean-EJB architecture (instead of my preference, which is actually
JSP->Servlet-Bean/EJB->JSP) is that you have to embed your procedural business
logic *inside* your JSP page.  This ties the two things together so that you
cannot change one without at least affecting the other.

Instead, I prefer to segregate all my business logic (but zero HTML generation)
into servlets, which can use EJBs when appropriate or other techniques (such as
direct JDBC access) when EJBs are not necessary.  I use beans to communicate the
processing results back to an appropriate JSP page for display, using
RequestDispatcher.forward() to transfer control.

Just as an example of the kinds of things that happens to applications during
their lifetime, consider that you've built a nice transactional web application
for browsers, using HTML for the presentation.  Now, your company decides to build
a version of this application for a wireless device, using WDML instead of HTML
(this is perfectly feasible with JSP and servlets).  If you've separated the
business logic as I suggest, you've got a pretty good chance at being able to
reuse most or all of it.  If you've embedded your business logic in the HTML code
in a JSP page, you're going to have to duplicate it, and maintain two versions
"forever".

>
>   Other than multi-threading do we have any other
> addtional adv. if we use Servlets..?
>

On larger scale (multi-developer) projects, the separated approach also allows you
to devote Java programmers to the business logic side, and user interface
developers to the JSP side.  They can work reasonably independently of each other,
once the bean interfaces are agreed upon, without stepping on each other's changes
to the same source files.

>
> Can someone help me..?
>
> Thanks in advance..
> Dheepa
>

Craig McClanahan

===========================================================================
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

Reply via email to