Marc Saegesser wrote:

> In Tomcat 3.2.x, specifying more than one name for a servlet in web.xml
> causes a separate instance to be created for each name and each instances
> init() method will et invoked.  Essentially creating a new servlet for each
> name as opposed to multiple names for a single instance of the servlet.
>
> The Servlet 2.2 spec (at least by my reading) doesn't provide clear guidance
> on the real behaviour of the <servlet-name> tag and the behaviour may vary
> from one servlet container to another.  I seem to recall that JRun, for
> example, didn't create multiple instances.
>

The spec is actually pretty clear ... for a servlet that does not implement
SingleThreadModel, there will be one servlet instance created per servlet
*definition* -- in other words, for each <servlet> element in your web.xml file,
even if they refer to the same servlet class.

In addition, if you use the invoker facility (/servlet/{servlet-class-name}) to
reference the same servlet class, that creates a new definition on the fly,
independent of any other definitions in web.xml.

Craig McClanahan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to