aspose file tools
The moose likes Servlets and the fly likes how can i update the databse for partcular user_id after session is expire ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "how can i update the databse for partcular user_id after session is expire ?" Watch "how can i update the databse for partcular user_id after session is expire ?" New topic
Author

how can i update the databse for partcular user_id after session is expire ?

shyam ji gautam
Ranch Hand

Joined: Sep 17, 2011
Posts: 46
dear all


i want to update the data for particular userid in database after session is expire how i can do this ?

first i elaborate the actual requirement in my application i want then when session time out happen then one particular flag for user id like 'test' is set ='no' and send the page to login.jsp
using filter
i am using hybernate so how can i update that flag for particular userid after the session is expire using hybernate .

Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2407
You can use an HttpSessionListener to get notified whenever a session expires.
shyam ji gautam
Ranch Hand

Joined: Sep 17, 2011
Posts: 46
i am using hybernate so how it will be doing in hybernate and my doubt is that how i pass the particular id key for update the row.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2407
You would get the ID out of the session (where, obviously, you'd need to store it first). The rest is just JDBC/Hibernate.
shyam ji gautam
Ranch Hand

Joined: Sep 17, 2011
Posts: 46
thanks

i am also confue can you give some code like we wnt to update data for user_id ='test' ;

then if session time out then how we use this id for update in databse in listener as your suggestion , any example
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2407
What difference does it make whether you call this code from within a servlet context listener, or any other place? I think for DB questions there's a separate forum here which would be better suited.
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2549
    
    2

Here is one example of session listener.


SCJP, SCWCD.
|Asking Good Questions|
 
I agree. Here's the link: http://zeroturnaround.com/jrebel/download
 
subject: how can i update the databse for partcular user_id after session is expire ?
 
Similar Threads
how to update colunm in database table for particular userid after session is expire
is admininstrator able to view the data for activity time?
how to handle session timeout
when user close the browse how i update the data related to that user in databse ?
hibernate+spring+mysql+tomcat