tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David J. Ferrero" <david.ferr...@zion.com>
Subject Re: Global Parameters
Date Fri, 04 Aug 2000 17:42:37 GMT
This is what I'm trying to do. I can do this easily with a servlet as
you say, but I'm wondering how to do this if my bootstrap is a Main.jsp?



Tim Kientzle wrote:
> 
> One common way around this sort of problem is to define a single
> servlet parameter with the filename of a Java 'properties' file.
> Look up java.util.Properties for how to load such a file.
> 
> That lets you maintain a complex configuration without having to
> edit web.xml every time.
> 
>                                         - Tim
> 
> Rene Duettra wrote:
> >
> > >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");
> > >
> > >Craig McClanaha
> > -------------------------------------------------------
> >
> > I used it this way. But how about accessing a servlet which has
> > no init parameters BEFORE the servlet, which has one.
> > If you try this:
> >  String paramValue =
> >       getServletContext().getInitParameter("paramName");
> >
> > paramValue will be null...
> >
> > I think there is an easier way than defining all parameters
> > for each servlet in the web.xml ...
> >
> > Thanks for answers.
> >
> > Rene

-- 
==========================================================
ZION SOFTWARE, LLC                     http://www.zion.com
==========================================================

Mime
View raw message