Hello Johnny,

Use <context-param>'s in your web.xml.

For instance:

    <context-param>
        <param-name>databaseUrl</param-name>
        <param-value>jdbc:postgresql:msrd</param-value>
    </context-param>


Context parameters can be added to your web.xml near the top of the
file after <display-name> and <description>

You can reference your parameters by doing this:

String myparameter = (String) context.getInitParameter("databaseUrl");

You can also use parameters for specific servlets:

<servlet>
        <servlet-name>log4j-init</servlet-name>
        
<servlet-class>org.enhydra.barracuda.core.util.logging.Log4jInit</servlet-class>
        <init-param>
            <!-- relative path to config file within current webapp -->
            <param-name>log4j-config</param-name>
            <param-value>WEB-INF/log4j.xml</param-value>
        </init-param>
</servlet>

And retrieve that by using the following in the init() method of said
servlet:

String configPath = getInitParameter("log4j-init");


You can also retrieve stuff from JNDI using Context Resources which
are specified in the server.xml.  I'll let you read up on that in the
Tomcat docs.

Does that help?


Jake


Monday, June 24, 2002, 4:26:51 AM, you wrote:


J>  to all the tomcat users,

J>  if i want to set my own environment variable for my application running in
J> tomcat, what should i do? do i have to edit the server.xml?

J>  in jserv, we using "ApJServEnvVar" for defining the environment variable in
J> jserv.conf, so how about tomcat?

J>  regards
J>  johnny.



J> --
J> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
J> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>



-- 
Best regards,
 Jacob                            mailto:[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to