aspose file tools*
The moose likes Servlets and the fly likes when user close the browse how i update the data related to that user in databse ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "when user close the browse how i update the data related to that user in databse ?" Watch "when user close the browse how i update the data related to that user in databse ?" New topic
Author

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

shyam ji gautam
Ranch Hand

Joined: Sep 17, 2011
Posts: 48
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

Joined: Dec 20, 2006
Posts: 2503
    
    8

Difficult. See this thread about the same subject.


OCUP UML fundamental and ITIL foundation
youtube channel
shyam ji gautam
Ranch Hand

Joined: Sep 17, 2011
Posts: 48
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

Joined: Mar 10, 2008
Posts: 326

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

Joined: Mar 22, 2000
Posts: 12806
    
    5
Whats wrong with waiting for the session timeout event?

Bill
Ove Lindström
Ranch Hand

Joined: Mar 10, 2008
Posts: 326

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

Joined: Oct 11, 2011
Posts: 70
Hi,
You can use the flowing code:
Ove Lindström
Ranch Hand

Joined: Mar 10, 2008
Posts: 326

abani patra wrote:Hi,
You can use the flowing code:


Yes, I said that 3 post ago...
 
 
subject: when user close the browse how i update the data related to that user in databse ?