Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Using init parameters

Keith Hankin

2004-04-21

Replies:

I have the following in my web.xml:
<context-param>
  <param-name>applicationName</param-name>
  <param-value>testApp</param-value>
</context-param>

My servlet class extends HttpServlet and has the following method:
  public void init(ServletConfig config) throws ServletException
  {
     super.init(config);
     configDir = getInitParameter("configDir");
     applicationName = getInitParameter("applicationName");
     System.out.println("configDir = " + configDir);
     System.out.println("applicationName = " + applicationName);
     jdbcAccess = new AddrJdbcAccess(configDir, applicationName);
  }

Both calls to getInitParameter() return null. What's wrong here?



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.