In the afternoon, my colleague found a problem: After logging on to the same application system and on the same computer with different users, the subsequent users will overwrite the previous user information!
The Code is as follows:
....................................
_ Request. getsessioncontext (). Add ("user", user );
....................................
At first, I did not agree: it should be so! Otherwise, it would be abnormal!
My colleague then asked: What should I do if the customer asks the users later to log on and do not rush out the previous user information?
Two problems arise:
(1) When the previous Code remains unchanged, are you sure that the login user will overwrite the previous Login User information?
(2) What should I do if I don't want to overwrite the previous users?
To prove it rigorously, I decided not to write a small program for testing.
Create a J2EE project with a JSP in it. Use the print session. GETID () method to determine whether the same session is opened twice on the same page!
Unexpectedly, there was a situation where:
(1) If the same browser (Note: ie9 and sogou are not the same browser.), And the sessionids opened twice are the same.
(2) If you useDifferentBrowser (Note: ie9 and sogou are not the same browser.), The sessionid opened twice is different.
With this conclusion, the answer to the question can be solved.