File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Multiple User problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Multiple User problem" Watch "Multiple User problem" New topic

Multiple User problem

karthik manick
Ranch Hand

Joined: Aug 25, 2009
Posts: 53
Hi, I created a simple application using JSPs and servlets. Using the IP address in URL, multiple users can login to my application.
When a user logs in to the application, it will browse the database using login id and displays the details in home page.
When the 2nd users logs into the applcation, he is also getting the same details of the 1st user. It looks like, its not browsing again and is showing thesssion values from 1st user.
Please help me in resolving this..
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63870

The most likely cause of such problems is using scriptlet declarations in a JSP -- bad idea, there should be no Java code in modern JSPs at all -- or using instance variables in a servlet.

Check your app for Java code in JSPs. Any you find should be refactored into Java classes.

Check your servlets for instance variables. A single servlet instance serves multiple threads and so must be written to be thread-safe.

[Asking smart questions] [About Bear] [Books by Bear]
karthik manick
Ranch Hand

Joined: Aug 25, 2009
Posts: 53
Thans a lot Bear.. This issue got resolved once i changed the instance variables to local variables.
I agree. Here's the link:
subject: Multiple User problem
It's not a secret anymore!