Matt Campbell wrote:
>
> Hi All,
>
> this is an addition to my last post, a bit more info in case its any use. I've
> just tried to run
> TOMCAT_HOME/webapps/examples/WEB-INF/classes/SnoopServlet.class after
> un-commenting its init-params in TOMCAT_HOME/webapps/examples/WEB-INF/web.xml
> The servlet runs fine, except that it doesnt find its init-params. I have made
> no changes except for un-commenting those params. Why wont it find them??
>
> Cheers
>
> Matt
>
Ah yes - this annoying little quirk.
If you address SnoopServlet.class directly as above, Tomcat does NOT
associate
it with the entry in web.xml therefore you don't get init params. If you
address
it as snoop - the alias that the web.xml sets up with:
<servlet>
<servlet-name>
snoop
</servlet-name>
<servlet-class>
SnoopServlet
</servlet-class>
<init-param>
<param-name>foo</param-name>
<param-value>bar</param-value>
</init-param>
</servlet>
then you will get the init params!!!!
--
WBB - [EMAIL PROTECTED]
Java Cert mock exams http://www.lanw.com/java/javacert/
Author of Java Developer's Guide to Servlets and JSP
ISBN 0-7821-2809-2
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]