aspose file tools*
The moose likes Servlets and the fly likes Save Logout time in database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Save Logout time in database" Watch "Save Logout time in database" New topic
Author

Save Logout time in database

pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 300
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

Joined: Feb 24, 2006
Posts: 6657
    
    5

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 ?


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Save Logout time in database
 
Similar Threads
Regarding JDBC concept
Problem with SessionId
Browser Closing without signout from site
Clear session on Browser Close
need to call a function before Session ends