On 10 Sep 2002, Craig Longman wrote:

> On Tue, 2002-09-10 at 18:16, Milt Epstein wrote:
> >
> > Remember, you're talking about a context listener, not a servlet
> > listener.  Their lifecycles are different.  The servlet lifecycle is
> > pretty well known -- that is, it is possible that servlets can be
> > created and destroyed by the servlet container as it wishes.  So for
> > servlets, you have to be prepared for that.  I haven't heard as much
> > about the context lifecycle -- although I imagine they too can be
> > created and destroyed by the servlet container.  So you probably set
> > up your code to handle that possibility.
>
> well, i'm going to have to be very careful.  i have no idea what context
> i'm receiving, but it doesn't appear to be the ActionServlet, there are
> no init parameters in it at all.

I'm confused (or maybe you are :-).  What do you mean, you have no
idea what context you're receiving?  There is only one context it can
receive, the context it's part of.  Remember, you're defining the
listener in the web.xml file, and that's part of a context.

As to init parameters, I'm not sure what you're trying to do with
them, but note that you can set up context parameters in the web.xml,
and that you can get the context (via the getServletContext() method)
from the ServletContextEvent that's passed to the context listener
methods (so you can have access to the context parameters).  You can
also use a properties file, as others have suggested.


> so, i'm a little bit further ahead, at least i have the preferred log to
> write to, but still no convenient method of passing it configuration
> parameters.  i'm off to investigate if there is any mechanism in the
> <listener> stuff that i can use.

See above.  It looks like Tomcat has some additional mechanisms for
handling configuration parameters (e.g. Listener tags in the
server.xml file, but that may make your set up not portable).

Milt Epstein
Research Programmer
Integration and Software Engineering (ISE)
Campus Information Technologies and Educational Services (CITES)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]


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

Reply via email to