You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Jeffrey, Rashid" <Ra...@bskyb.com> on 2000/07/07 16:18:27 UTC
[TOMCAT-USER] Use of in web.xml
Using version 3.1 Beta
Dear all, I am attempting to access an <init-param> value from my web.xml
for a servlet, alas with no success.
web.xml snippet:
<servlet>
<servlet-name>InitCounter</servlet-name>
<init-param>
<param-name>initial</param-name>
<param-value>5</param-value>
</init-param>
</servlet>
Servlet snippet from Jason Hunter's book, ex 3.3. For me this always results
in the exception being raised:
public void init(ServletConfig config) throws ServletException {
super.init(config);
String initial = config.getInitParameter("initial");
try {
count = Integer.parseInt(initial);
}
catch (NumberFormatException e) {
count = 999;
}
}
Any ideas?
Regards
Rashid
**********************************************************************
Information in this email is confidential and may be privileged.
It is intended for the addressee only. If you have received it in error,
please notify the sender immediately and delete it from your system.
You should not otherwise copy it, retransmit it or use or disclose its
contents to anyone.
Thank you for your co-operation.
**********************************************************************