Tomcat 5 provides a JNDI InitialContext implementation instance for each web application running under it.
The
J2EE standard provides a standard set of elements in the /WEB-INF/web.xml file to reference resources; resources referenced in these elements must be defined in an application-server-specific configuration.
For Tomcat 5, these entries in per-web-application InitialContext are configured in the <Context> elements that can be specified in either $CATALINA_HOME/conf/server.xml or, preferably, the per-web-application context XML file (either META-INF/context.xml).
You can to define an environment resource like this:
<Environment name="myEnvName" value="whatever"
type="java.lang.String" override="false"/>
and then read it from java code:
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
String myEnvName = (String) envCtx .lookup("myEnvName");
For more info go to
http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html
SCJP 5, SCWCD 5, SCBCD 5,
SCEA 5,
OCUP Fundamental,
OCUP Intermediate,
OCUP Advanced,
IBM Certified Solution Designer - Object Oriented Analysis and Design, vUML 2