• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple tabs share sessions so data in going into inconsistent state?

 
shyam ji gautam
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
ExamLab Creator
Marshal
Pie
Posts: 4325
236
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic