>>> Brian McMullan <[EMAIL PROTECTED]> 27/10/99 23:15:01 >>>

>Is there a performance advantage to chaining
>several servlets together? What is the usual
>practice?

There is a small performance hit associated with using
RequestDispatchers to chain servlets together. This can become serious
if you are doing *a lot* of redirecting amongst servlets (which is
very unusual).


In the past James Duncan Davidson has argued (and I tend to agree
with him) that servlets are like a main() method in that they simply
provide an entry point for running a program over the web.

Looking at it this way means you build one servlet and have that talk
to many sub-objects. This can be quite a tidy and efficient system as
opposed to having many servlets.

The times I use more than one servlet are when there is a resonable
difference in functionality between the servlets themselves.

For example, in a simple banking app you might have a servlet to deal
with the main menu, a servlet to handle the current account screen and
a servlet to handle the deposit acount.

Alternately you can do it by class of object, in this case you would
have a servlet for account type pages and another for menu type
pages.

I would say that if your system uses a single template you only need
one servlet.


It is one of the most confusing design aspects of servlets this "one
or many" question so don't worry if it causes you some problems.


Nic Ferrier

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to