• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Save Logout time in database

 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi List[],


I am storing the login and logout time in database.

When the user login i am calling the DAO object at that time and inserting in database.
But for log out time i am using session listener.
In side the method

public void sessionDestroyed(HttpSessionEvent arg0) {

}

i am updating the log out time by comparing the session id and date .
like this : update acces_log set log_out_time =? where session_id=session.getID and date =Date;;

Is this the right way to do this.

Please tell me.

Thanks

 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It might now always be accurate since a user might not actually use the logout button. The user could close the browser and walk away. Is it all right if your session times out after the timeout time set in web.xml ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic