Yes, the variable is only intialized the first time. It's not implicitly
static -- so yes, if one user changes it, others will see the change.
Wouldn't it be better if you stored this value in the session object since
you want "a seperate value to each request?"
Vik
-----Original Message-----
From: Todd Mytkowicz [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 06, 2000 4:08 PM
To: [EMAIL PROTECTED]
Subject: Non static global variables
Hello all,
In my servlet, I create an instance variable as such...
private boolean temp = false;
...
An instance of this servlet is created the first time the servlet is called.
My understanding is that this variable is only initialized that first time.
Is this temp variable implicitly static? ie, if one user changes the
variable, will other servlets see that change?
In more general terms, I want this variable to act as a global variable with
a seperate value to each request.
If user A requests my servlet and changes the temp to true, will subsequent
users see a value of true?
Thanks for the help.
Todd Mytkowicz:
[EMAIL PROTECTED]
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html