Session Problem
Hi all,
I dont know whats wrong and how to solve this issue. User needs to logon to access my application. Name of the user is displayed in every page he navigates. When the user logs in i fetch the user name from database using the user login ID which is saved in session variable and display the name in every page.
Sometimes this problem occurs. Say for eg. if user A logs in then his name Mr.A should be displayed in every page he navigates. For user B his name Mr.B should be displayed. But what happens is if Mr.A logs in it displays the name of some other person say Mr.D. This problem occurs sometime and i dont know what could be the cause.
It will be of great help if someone take me into right path to find the cause.
Thanks
[766 byte] By [
thanua] at [2007-11-27 6:35:08]

# 4
I wanted to know the technical details how you saved this value in session, not the functionality details. Are you using HttpSession#setAttribute() and HttpSession#getAttribute() to set and get values from session? (which is the right way).
# 5
yes my db has unique user names which is same as employee id. it is the primary key.
when the user clicks the link logout it takes to the logout.jsp where
i user
session.invalidate();
to invalidate the session. Is this the right method to invalidate or should i add extra piece of code to invalidate session properly. i think this is where the problem exists.
Thanks,
Thanuja.
thanua at 2007-7-12 18:02:05 >

# 8
> yes balu iam sorry. ya i user session.setAttribute
> and session.getAttribute.
Well, then there is likely a flaw/bug somewhere in your code logic. Re-read the code, run the debugger, try to reproduce it yourself using at least two instances of an useragent.
It just sounds like that you're storing the value in the application context and/or in a static variable.