tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: context-param vs. env-entry
Date Tue, 18 Jul 2000 17:50:00 GMT
Volker Turau wrote:

> Hi,
> why does the deployment descriptor for web applications contain the
> element context-param AND env-entry. Both can be used for external
> parameters.
> What is the idea of having both?
> When do I use which one?
> I guess env-entry is used to be compatible with J2EE, because all other
> modules include it (e.g. enterprise beans).

The <env-entry>, <resource-ref>, and <ejb-ref> entries in the web.xml file
are indeed compatible with J2EE.  They require your servlet container to
make the corresponding data available through a JNDI naming context --
which Tomcat currently does not do.

Thus, the best way to provide application-wide initialization parameters to
your Tomcat servlets is to use context initialization parameters
(<context-param>) and read them with the ServletContext.getInitParameter
family of methods.

> volker turau

Craig McClanahan

View raw message