| Author |
Multiple tabs share sessions so data in going into inconsistent state?
|
shyam ji gautam
Ranch Hand
Joined: Sep 17, 2011
Posts: 46
|
|
Dear all
i face a problem when one men which name is arun has two userid: arun1
and arun2
he use two tabs in same browser and login first with arun1 and now second time with arun2 so arun1 think he is doing something transaction but in databses this entry is goes on name of arun2 (latest login )
because browser shres the same sessionid with different tabs . i know this fact
i want that when second user (arun2) will be login then arun1 will automatically goes to logout and login screen will be coming for arun1
how i implement these because these feature si have seen in gmail also .
thanks
|
 |
Devaka Cooray
Saloon Keeper
Joined: Jul 29, 2008
Posts: 2691
|
|
|
You can implement it in many different ways. In one approach, you can use ajax and poll the status for the user ID, which is currently being displayed. Implement a Servlet that checks whether the given user ID belongs to the current session. If it isn't, send an ajax response stating that, and your JavaScripts should redirect the user to the login screen. In another approach, you can store a cookie that contains the current user ID. Using JavaScripts, read that cookie in regular basis and check whether the current user ID is equivalent to what exists in the cookie. When it isn't, that's the time to redirect to the login page.
|
Author of ExamLab (Download) - the free mock exam kit for SCJP / OCPJP
Home Page -- Twitter Profile -- JavaRanch FAQ -- How to Ask a Question
|
 |
 |
|
|
subject: Multiple tabs share sessions so data in going into inconsistent state?
|
|
|