tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: context parameters
Date Mon, 09 Oct 2000 04:34:30 GMT
Fnystal wrote:

> I have added the following data to a web.xml file, in the hope that I could
> point to a configuration file.  From the logs, I can see that the file is
> read (I got duplicate errors, before I delete the stuff from the default
> web.xml in the $TOMCAT/conf dir.
>
>     <context-param>
>          <param-name>conf</param-name>
>          <param-value>/usr/local/tomcat/webapps/xitema/WEB-INF/classes/InetSale/InetSale.conf</param-value>
>     </context-param>
>
> I have a test servlet which reads all init parameter with the following code:
>
>        out.println("<BR>Initparameters:");
>        Enumeration e = getServletConfig().getInitParameterNames();
>        String tmps = null;
>        while (e.hasMoreElements()) {
>          if ((tmps=(String)e.nextElement())!=null)
>            out.println("<BR>InitParam "+tmps+" = "+
> getServletConfig().getInitParameter(tmps));
>        }
>

This call returns initialization parameters for your *servlet*, not for your *context*.  To
get the values
entered via <context-param>, do this instead:

    getServletContext().getInitParameter(tmps);

Craig McClanahan

====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat



Mime
View raw message