java - how to insert value in DB when session is expired -
in work login, use authentication jsp page setting max inactive time 60 prevent multiple logins single username.
i have created field status in db when user logs in status active , no other user can login same username.
now problem how set status inactive in db when session expires.
to update status inactive did
login=(string)session.getattribute("login"); preparedstatement pt = con.preparestatement("update authentication set status='inactive' username='"+login+"'"); so when session expired, login give null. please tell me how solve problem
use httpsessionactivationlistener
public void sessiondidactivate(httpsessionevent se) notification session has been activated.
public void sessionwillpassivate(httpsessionevent se) notification session passivated.
or
sessioncreated(httpsessionevent se) receives notification session has been created.
sessiondestroyed(httpsessionevent se) receives notification session invalidated.
Comments
Post a Comment