Alex Birman wrote:

> I have two similar applications. I would like to use the same servlet
> class and create two servlets, one for each application, by providing
> different parameter values (e.g. database name).
>
> I imagine that not all servlet engines would support this. I tried it
> first with the servlet-runner and it doesn't seem to work (I am using
> jdk1.2beta3 on Windows95). I tried it then with DominoGo on NT with
> jdk1.1.7A and jsdk2.0 and it seemed to work, but am not sure any more.
>
> I would like to find out if this mode of operation is used often, and if
> it's supported. How would it be described in the documentation for the
> servlet engine?

Alex,

This is actually pretty common, and should work fine, providing you're not
doing anything that might confuse one or both of the instances, like sharing a
class variable without synchronizing it. If your servlet is thread-safe, then
all you have to do is create two separate entries for it in your servlet
runner, each with a different alias and different startup parameter. I'm
assuming you've already written the class to respond appropriately to the
parameter(s).

If you want to be absolutely positive it's working, just display the parameters
back to the browser when the servlet is accessed (so you know which one is
running).

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kito D. Mann
[EMAIL PROTECTED]
Virtua Communications Corp
http://www.virtua.com

___________________________________________________________________________
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