> -----Original Message-----
> From: Duncan [mailto:[EMAIL PROTECTED]
> 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" <[EMAIL PROTECTED]>
> > To: "Tomcat User List" <[EMAIL PROTECTED]>
> > 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to