Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

when user close the browse how i update the data related to that user in databse ?

 
shyam ji gautam
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all


how can i update the value for particular userid in databse if that user close the browser before session time out .

let us suppose i want to update the flag in database for userid='test' when test close the browser before session timeout.


thanks
 
Jan Cumps
Bartender
Posts: 2584
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Difficult. See this thread about the same subject.
 
shyam ji gautam
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jan Cumps wrote:Difficult. See this thread about the same subject.



it is right but someone told me that it is possible with the java script and ajax so can you give me some suggestions regarding this i am using jsp page .

thanks
 
Ove Lindström
Ranch Hand
Posts: 326
Android Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is quite easy, conceptually at least. Concept is like this:




Note: there are a lot of cases when this does not work as you think...
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13055
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whats wrong with waiting for the session timeout event?

Bill
 
Ove Lindström
Ranch Hand
Posts: 326
Android Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William Brogden wrote:Whats wrong with waiting for the session timeout event?

Bill


Nothing, if that is the only thing you want to do. But if you as an example, are coding an online game, you might want to notify all other users that 'Player X went link dead' if you loose the connection or 'Player X closed the browser and gave up'. Then you can't really wait for the session to just die. There might be quite some more logic that needs to be executed on the server side when this things happens.

One thing, if we stay in the game, is that if I am playing a slot machine, and the browser crashes under me when I just hit the Jackpot, I still would want to claim that winning automatically. People tend to be quite annoyed at systems that relies on them to login again an hope that their session can be retrieved based on their user id...
 
abani patra
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
You can use the flowing code:
 
Ove Lindström
Ranch Hand
Posts: 326
Android Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
abani patra wrote:Hi,
You can use the flowing code:


Yes, I said that 3 post ago...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic