Thanks for your reply!

Comments inlined

2008/7/8 Christopher Schultz <[EMAIL PROTECTED]>:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Jean-François,
>
> Jean-François Ménard wrote:
> | Using Tomcat 6.0.13, I try to define some context parameters in my
> | context file (in conf/Cataline/localhost/<app_name>.xml)
>
> That should be conf/Catalina/localhost/<app_name>.xml

Yes, it is, just a typo in the message...

>
> | as described in the documentation
> | (http://tomcat.apache.org/tomcat-6.0-doc/config/context.html) but it
> | simply doesn't work!  I can see the parameters defined in my web.xml,
> | but not those defined in my context file.
>
> http://tomcat.apache.org/tomcat-6.0-doc/config/context.html#Context+Parameters
> indicates that <Parameter> in context.xml ought to be equivalent to
> <context-param> in web.xml.
>
> Have you defined the same parameter in both files? If so, you should
> take care not to set override="false", or your web.xml version will not
> be clobbered by the context.xml version.

No, the parameter is only in the context file, not in both.

>
> | Shouldn't the parameter be visible by the servlet context? ex.
> | context.getInitParameter("aParameterName")
>
> Yes, it should. Could you provide a sample context.xml and servlet that
> do not work together?
>

Ok, here it is.

web.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";>

        <display-name>App</display-name>
        
        <context-param>
                <param-name>paramInWebXml</param-name>
                <param-value>ParamValue</param-value>
        </context-param>

...

</web-app>

Context file (conf/Catalina/localhost/app.xml:

<Context path="app">

  <Parameter name ="paramInContext" value="ParamValue" />

</Context>

In my app, I can see the parameter defined in web.xml, not the one in
the context file...

As a side note, if I deploy the app in a standalone Tomcat, the
problem appear, but if I use the app with eclipse wtp, everything is
fine.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to