tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ilari Kontinen <ikont...@cc.hut.fi>
Subject RE: Global Variables
Date Wed, 03 Dec 2003 17:45:45 GMT
> -----Original Message-----
> From: Duncan [mailto:dsmith@deckertelecom.net]
> Sent: Wednesday, December 03, 2003 11:50 AM
> To: Tomcat Users List
> Subject: Re: Global Variables
> 
> 
> Thanks for the replies, but what do I define servletContext as?
> 

An easy way to get the ServletContext from JSP-page is to use the
Servlet-method getServletContext(). So for getting the context
parameter, add the following code-snipped:

<% String param = getServletContext().getInitParameter("param"); %>

And for then on, you can reference it e.g. by:

<%= param %>

> Many thanks
> Duncan
> 
> Jardin Xavier wrote:
> 
> > use
> >
> > <context-param>
> >  <param-name>param</param-name>
> >     <param-value>value</param-value>
> > </context-param>
> >
> > in the web.xml
> >
> > and String param = servletContext.getInitParameter("param");
> >
> > in the JSP.
> >
> > ----- Original Message -----
> > From: "Duncan" <dsmith@deckertelecom.net>
> > To: "Tomcat User List" <tomcat-user@jakarta.apache.org>
> > Sent: Wednesday, December 03, 2003 5:08 PM
> > Subject: Global Variables
> >
> > > Is there a way to set global variables in the web.xml which can be read
> > > by any JSP page?
> > >
> > > Cheers,
> > > -Duncan


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message