The only sensible way I could find to do this was to store the variables in
the session. So you can do something like this:

void doGet (....)
{
        String x = "some data";
        HttpSession thisSession = req.getSession (true);
        thisSession.putValue ("X", x);

        function1 (thisSession);
}

void function1 (HttpSession thisSession)
{
        String x = thisSession.getValue ("X");
}

then you just need to make sure you pass the session around from one
function to another - not too tedious. And it doesn't seem to be too
inefficient either as far as I can tell.

Hope this helps,

Ben

-----Original Message-----
From: Carlos Santos [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 19, 1999 11:22 AM
To: [EMAIL PROTECTED]
Subject: Private vars


Is there any way i can declare a variable so that any method within my
class can access and/or alter its content without explicitly having to pass
the variable down to every method through an input parameter ?

I just read that variables defined on a class level are not only accessible
to that class's methods but to every other instance (thread) of the class,
as well. I want the content of my variables to be related to one user only
and i don't want a user which is connecting at the same time and calling
the same class to have the chance to alter that variable content.

Any ideas ?
thanks.
Carlos.


-----------------------------------------------------
CARLOS SANTOS  (ICQ: 21537583)
NETOSFERA: http://www.netosfera.pt
Tel(Phone): (+351 53 276998)
Fax: (+351 53 274255)
Braga - Portugal

___________________________________________________________________________
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

Reply via email to