-
1. Re: getInitParameter() always returns null
emdevlin Sep 4, 2002 9:19 PM (in response to jauri)Hey,
I put your init params in my init() and saw a value. Admittedly, I'm using jboss301_tomcat404, but your set up seems sound. I went through something similar the other night when porting my app from jboss 2.4.3 to 3.0.1. The context-param elements were below servlet elements in the web.xml file and were not picked up by the default xml parser. This does not seem to be the case with your setup as your layout conforms to web-app_2_2.dtd and web-app_2_3.dtd. You can try a different parser (I think this is configurable with command line parameters. The only other thing that comes to mind is the DOCTYPE specified at the top of web.xml? -
2. Re: getInitParameter() always returns null
emdevlin Sep 4, 2002 9:30 PM (in response to jauri)Hey,
This was on one line in the web.xml
<servlet-name>asiServlet</servlet-name><servlet-class>com.alastore.servlets.asiServlet</servlet-class><init-param><param-name>role</param-name><param-value>CDSUser</param-value></init-param>
This was in the servlet.
public void init()
throws ServletException
{
System.out.println( "************************* eric ************************" );
System.out.println( getServletConfig().getInitParameter("role") );
System.out.println( "************************* eric ************************" );
This was in the output
2002-09-04 20:18:53,895 INFO [STDOUT] ************************* eric ************************
2002-09-04 20:18:53,895 INFO [STDOUT] CDSUser
2002-09-04 20:18:53,895 INFO [STDOUT] ************************* eric ************************
This is the doctype in my web.xml
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
Hope it helps
Eric -
3. Re: getInitParameter() always returns null
jules Sep 5, 2002 8:47 PM (in response to jauri)If the problem persists, please send me the src and the resulting .war.
Thanks,
Jules@mortbay.com