You're problem comes from the fact that for every different method
of reaching your servlet creates a new instance of it. If you store things
in the static variables they will be available across all calls, but you
must be careful that you don't overwrite these values. Here's what I think
your general lifecycle is like:
at startup create instance, set init-params correctly
at request, create instance, set init-params to null (not specified
in web.xml), process request.
What you need to do is to associted the start up with the mapping.
You do this by using the same servlet name for your servlet-mapping and
init-param tags.
Does this make sense?
Randy
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 23, 2001 6:16 PM
To: [EMAIL PROTECTED]
Subject: RE: deep web.xml problem
-Tomcats
I recieved response:
Can't say for sure but why not store init params in static vars if your
servlet class on load-on-startup call to init i.e.
I changed the code as described but still get null values... except for
the private static int object... It actually has a value not null. What
gives here? Also, both servlets work as coded using VisualAge 3.5 IDE
and the server launcher tool. VisualAge also uses an XML file for
init-params, but the set-up is a little differerent.. But everything works
there... so I don't think bug is in java source.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]