Any variables that are used in the methods of a servlet are independant
of each request. So I could declare a variable in my doPost routine and
assign the value of the login parameter to that variable. This variable
will not be seen by the other requests going into the servlet. The only
time the variables are seen by other parts of the servlet is when they
are declared as class level variables. These variables should be
declared to be things that every invocation of the methods needs to see.

For Example: In the servlet I have developed, I read in a configuration
file to provide information about my database. I store this information
in class variables so I only have to read it in once(in the init).

When a user connects, I get his login name and his password. I store
these in variable I declared in the doPost method. I then run my
validation routines against the login name.

Doug Bridges


>Date:         Tue, 9 Mar 1999 11:06:37 -0500
>Reply-To: "A mailing list for discussion about Sun Microsystem's Java
>              Servlet API Technology." <[EMAIL PROTECTED]>
>From: Hector Fabio Meza Martinez <[EMAIL PROTECTED]>
>Subject:      servlet variables
>To: [EMAIL PROTECTED]
>
>Hi
>
>Is there any way to create a variable in a servlet that will take info
from
>a form, but it will be different with each invocation? i.e. if two
browsers
>request the servlet with say, a login code, the variable should store
the
>code, and the value should be differente for each request.
>
>Any help would be appreciated
>
>Hector
>
>___________________________________________________________________________
>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
>


______________________________________________________
Get Your Private, Free Email 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

Reply via email to