tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <>
Subject Re: how to set environment variable in tomcat?
Date Mon, 24 Jun 2002 14:55:24 GMT
Hello Johnny,

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

For instance:


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:

            <!-- relative path to config file within current webapp -->

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

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?


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:   <>
J> For additional commands, e-mail: <>

Best regards,

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message