tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amos Shapira <amos.shap...@webcollage.com>
Subject RE: Global Parameters
Date Fri, 11 Aug 2000 11:00:51 GMT
Hi,

Just use a scriptlet, you know, <% application.getInitParameters(); %>
("application" is the implicit JSP ServletContext variable.)

BTW, the method to implement for initial settup in JSP is jspInit().

Hope this helps,

--Amos

> -----Original Message-----
> From: David J. Ferrero [mailto:david.ferrero@zion.com]
> Sent: Thursday, August 10, 2000 2:23 PM
> To: tomcat-user@jakarta.apache.org
> Cc: amos.shapira@webcollage.com
> Subject: RE: Global Parameters
> 
> 
> Could you ellaborate on the jsp init you mentioned?
> 
> I'm not actually trying to take globals before servlet specific as the
> thread was focused on. 
> 
> I understand how a servlet can get init parameters from the 
> web.xml via
> getInitParameter method, but I'm not clear how a jsp can do the same.
> Ie: I know a jsp gets compiled into a servlet by jsp/servlet 
> engine, but
> I'm not clear what the JSP code looks like to access 
> getInitParameter...
> 
> Thanks for further insight.
> 
> - David
> 
> -------- Original Message --------
> Subject: RE: Global Parameters
> Date: Sun, 6 Aug 2000 12:17:19 +0300
> From: Amos Shapira <amos.shapira@webcollage.com>
> Reply-To: tomcat-user@jakarta.apache.org
> To: "'tomcat-user@jakarta.apache.org'" 
> <tomcat-user@jakarta.apache.org>
> 
> You mean you want to make sure the params are read before
> any servlet in the application gets invoked?
> 
> Simple - just add a "<load-on-startup>" tag to one of the servlets or
> JSP's.  This will make sure that this particular servlet's init() gets
> called
> upon server startup.  JSP's can implant code in their servlet's init()
> by
> defining a function called jsp_init() or somesuch.
> 
> --Amos
>  
> 
> > -----Original Message-----
> > From: David J. Ferrero [mailto:david.ferrero@zion.com]
> > Sent: Friday, August 04, 2000 8:43 PM
> > To: tomcat-user@jakarta.apache.org
> > Subject: Re: Global Parameters
> > 
> > 
> > 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
> >
> 

Mime
View raw message