You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Arash Ramin <we...@digitalroom.net> on 2005/07/26 04:47:08 UTC

Init parameter in context.xml

In lieu of using web.xml, I'm trying to add an init parameter in our
application's context.xml file:

  <context path="/appName" ...>
    <parameter name="paramName" value="dummyValue"/>
  </context>

According to the Tomcat docs, this is equivalent to using the following in
web.xml:

  <context-param>
    <param-name>paramName</param-name>
    <param-value>dummyValue</param-value>
  </context-param>

In my JSP page, I try the following:

<%= getServletContext().getInitParameter("helpAppName") %>

but I get simply get 'null'.  If I move the parameter to web.xml, everything
works fine.

Our context.xml file is generated through an Ant script for different
environments, hence my need to put the parameter there instead of web.xml


Any clues appreciated.  Running on Tomcat 5.0.28.

- Arash



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Init parameter in context.xml

Posted by Arash Ramin <we...@digitalroom.net>.
You're right, thanks.  I was missing the capital 'P' in the <Parameter>
property.

When defining parameters under ResourceParams, it's all lowercase though.

- Arash

> -----Original Message-----
> From: Tim Funk [mailto:funkman@joedog.org] 
> Sent: Tuesday, July 26, 2005 03:44
> To: Tomcat Users List
> Subject: Re: Init parameter in context.xml
> 
> Only a guess.... try
>     <Context path="/appName" ...>
>      <Parameter name="paramName" value="dummyValue"/>
>     </Context>
> 
> -Tim
> 
> Arash Ramin wrote:
> 
> > In lieu of using web.xml, I'm trying to add an init 
> parameter in our 
> > application's context.xml file:
> > 
> >   <context path="/appName" ...>
> >     <parameter name="paramName" value="dummyValue"/>
> >   </context>
> > 
> > According to the Tomcat docs, this is equivalent to using the 
> > following in
> > web.xml:
> > 
> >   <context-param>
> >     <param-name>paramName</param-name>
> >     <param-value>dummyValue</param-value>
> >   </context-param>
> > 
> > In my JSP page, I try the following:
> > 
> > <%= getServletContext().getInitParameter("helpAppName") %>
> > 
> > but I get simply get 'null'.  If I move the parameter to web.xml, 
> > everything works fine.
> > 
> > Our context.xml file is generated through an Ant script for 
> different 
> > environments, hence my need to put the parameter there instead of 
> > web.xml
> >  
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Init parameter in context.xml

Posted by Tim Funk <fu...@joedog.org>.
Only a guess.... try
    <Context path="/appName" ...>
     <Parameter name="paramName" value="dummyValue"/>
    </Context>

-Tim

Arash Ramin wrote:

> In lieu of using web.xml, I'm trying to add an init parameter in our
> application's context.xml file:
> 
>   <context path="/appName" ...>
>     <parameter name="paramName" value="dummyValue"/>
>   </context>
> 
> According to the Tomcat docs, this is equivalent to using the following in
> web.xml:
> 
>   <context-param>
>     <param-name>paramName</param-name>
>     <param-value>dummyValue</param-value>
>   </context-param>
> 
> In my JSP page, I try the following:
> 
> <%= getServletContext().getInitParameter("helpAppName") %>
> 
> but I get simply get 'null'.  If I move the parameter to web.xml, everything
> works fine.
> 
> Our context.xml file is generated through an Ant script for different
> environments, hence my need to put the parameter there instead of web.xml
>  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org