java - how to send an alert when session expires -
i wanted throw alert when session expires , when press ok button in alert box take login page. thought create timer , timertask , in run method of later class check if session exists or not. tried create class in jsp page showing error. can create in servlet pages in jsp , idea not useful.now created sessionlistner , in session destroyed method want link login page have problem here too.i can not use response method in sessiondestroyed method.please tell me there other ways
you can use javascript like:
var sessiontimeout = "<%= session.timeout %>"; function displaysessiontimeout() { //assigning minutes left session timeout label document.getelementbyid("<%= lblsessiontime.clientid %>").innertext = sessiontimeout; sessiontimeout = sessiontimeout - 1; //if session not less 0 if (sessiontimeout >= 0) //call function again after 1 minute delay window.settimeout("displaysessiontimeout()", 60000); else { //show message box alert("your current session over."); } } for more details visit here
Comments
Post a Comment