Im still new to servlet/jsp subject, and I've a question, since the variable inside the init() is instance, how is it possible to make a servlet/jsp have a different counter for each instance servlet? Example: User A and B accesing the same servlet page. User A has a counter 0 and everytime it refreshes it accumulates User B has same procedure but the counter is independent from User A. Thanks.
Joined: Oct 25, 2003
Generally there is only one instance of a servlet, and multiple client requests result in multiple threads each calling the service method of the single servlet instance. If you want to count how many times each user accesses the page (=servlet) you may want to use a session variable. something like this, in your doGet for example
Joined: Jun 06, 2002
Hmm , ok, it's not really possible with the request object. Thanks Rajeesh.
Joined: Nov 07, 2001
Originally posted by Nelson Nadal: Hmm , ok, it's not really possible with the request object. Thanks Rajeesh.
Even it is possible with request object by using Hidden form fields or URL rewriting, Cookies technologies (Basically all the session tracking methods will support). Regards, M.S.Raman