Mala Ramakrishnan wrote:

> Hi,
>
> I wanted to learn how to pass init parameters through web.xml, so I
> uncommented the following from
> jakarta-tomcat-3.1/webapps/examples/WEB-INF/web.xml:
> <init-param>
>     <param-name>foo</param-name>
>    <param-value>bar</param-value>
> </init-param>
>
> Yet, when I call SnoopServlet on my browser as follows:
> http://www.blahblah.com:8080/examples/servlet/SnoopServlet
>
> I get empty fields in Servlet init parameters.
>
> I tried the same with rewriting my own SnoopServlet and yet get null in
> this field. Why would that be?
>

Using "/servlet/SnoopServlet" means you are calling the invoker servlet (the one
that is mapped to "/servlet/*"), which then creates a new servlet definition for
a servlet mapped to "/servlet/SnoopServlet".  If you want to reference
initialization parameters, you will need to create your own <servlet>
definition, then create a <servlet-mapping> that maps one or more URLs to it.

>
> Mala

Craig McClanahan


Reply via email to