On Wed, 27 Nov 2002, Rasputin wrote:

> Date: Wed, 27 Nov 2002 17:08:20 +0000
> From: Rasputin <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>,
>      Rasputin <[EMAIL PROTECTED]>
> To: Andy Eastham <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED]
> Subject: Re: setting Context attributes in web.xml/server.xml?
>
> * Andy Eastham <[EMAIL PROTECTED]> [1140 16:40]:
> > Rasputin,
> >
> > It's in web.xml
>
> Sorry, I can't see it.
>
> There's a
>
> <context-param>
>
> element, but I need a context *attribute*, and I don't think they
> can be set in tomcat.

The <context-param> element, as you note, sets a context init
parameter, not a context attribute.  Context
attributes must be set programatically, not from a web.xml file.

A convenient way to set things up is to create a ServletContextListener
(assumes you're running Tomcat 4 or later) and configure it in a
<listener> element in web.xml.  The contextInitialized() method will be
called when your web application is first started, and that is a perfect
place to set up whatever context attributes you need.

>
> > See sample chapter on www.moreservlets.com for more info.
>
> Actually, I bought the book :)

Craig


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to