tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Souther <>
Subject Re: How to add variables into WEB-INF/web.xml or META-INF/*.* ?
Date Thu, 09 Dec 2004 11:20:32 GMT
I should want to add variables like ODBC name into
> %Tomcat-webapps%/WEB_INF/web.xml. How can you do it? How do you use it in
> java code (jsp, servlet, basic class).

You will want to read up on context initialization parameters and
servlet initialization parameters.

For a context init param (application wide) you would enter
something like this in your web.xml file:

      The value of this message is stored in a context init param
Then to retrieve the parameter from a servlet:

or from a JSP:

If you're interested, there is an example app you can download at:

look for Simple Context Init Params

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

View raw message