You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mala Ramakrishnan <ma...@speedtrak.com> on 2000/11/21 08:10:18 UTC
SnoopServlet - passing params through web.xml
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?
Mala
Re: SnoopServlet - passing params through web.xml
Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
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