You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Randy Layman <ra...@aswethink.com> on 2001/10/04 14:24:21 UTC

RE: [tomcat3.2] some questions


> -----Original Message-----
> From: Christian Ribeaud [mailto:christian.ribeaud@predict.ch]
> Sent: Thursday, October 04, 2001 8:56 AM
> To: tomcat-user@jakarta.apache.org
> Subject: [tomcat3.2] some questions
> 
> 
> Hi,
> 
> I have been working for a few months with tomcat and I am 
> very satisfied with it.
> I have been arrived at the point where I would like to 
> understand this software more and I have got 
> 3 questions:
> 1) I noticed that if you use ServletContext.setAttribute() in 
> the servlet's init() function, this Object
>    will not be reachable in the same servlet's service() 
> function. Why this?
I've never used this and don't know - it seems like the setAttribute
should set for the service method of the same servlet.

> 2) In one servlet context you could have more than one 
> instance of the same servlet, couldn't you?
>    Will the function init() be called for every instance?
Yes, init will be called for each instance (perhaps this is the problem
with #1?)

> 3) If I define the value of a static class variable in the 
> init() function,
>    will this variable always have the same value, I mean for 
> every instance of the class?
For each instance loaded by the same classloader.  If you are using two
different class loaders (for instance, two different web apps), the static
values don't cross.

> I would be very grateful if someone could answer me. Have a nice day.
> Cheers,
> 
> christian
>