tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wolfgang Stein <zo...@gmd-net.de>
Subject Re: global parameters
Date Thu, 03 Aug 2000 17:16:58 GMT
In cases where the Servlet Container doesn't already support
Servlet API 2.2  e.g. Apache JServ or Oracle App Server
you have to work around with System Properties.

Set the Property in the Tomcat startup script with the -D option
and retrieve it with
  System.getProperty("name");

But that's not clean because all contexts can access and 
change it.

Wolfgang



> -----Original Message-----
> From: Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
> Sent: Thursday, August 03, 2000 6:38 PM
> To: tomcat-user@jakarta.apache.org
> Subject: Re: global parameters
> 
> 
> Rene Duettra wrote:
> 
> > Hi,
> > Normally I use web.xml to define parameters for servlets.
> > Now I need to define some which should apply to all servlets.
> > I think there is an easier way than defining all parameters
> > for each servlet in the web.xml ...
> >
> 
> The easiest way to do this is to use context initialization 
> parameters,
> rather than servlet initialization parameters.  I don't have 
> the Servlet
> 2.2 spec in front of me, but it's probably <context-param> or 
> something
> like that.
> 
> In the servlet, you retrieve such a parameter like this:
> 
>     String paramValue =
>       getServletContext().getInitParameter("paramName");
> 
> >
> > Thanks for answers.
> >
> > Rene
> 
> Craig McClanahan
>

Mime
View raw message