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?

This is supported by all servlet engines I've used (JWS, Apache JServ, JRun,
ServletExec, WebSphere and our own WAICoolRunner and LiteWebServer products).
The way it's done is that you configure the same class with different names
and init arguments, typically in the servlets.properties file (or through
the Admin GUI). Example:

  servlet.firstName.code=MyServlet
  servlet.firstName.initArgs=param1=foo
  servlet.secondName.code=MyServlet
  servlet.secondName.initArgs=param1=bar

You can then access the two instances as /servlet/firstName and
/servlet/secondName, and each will be initialized with its own
init args.



--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.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