java - After session timeout redirect to last visited page for previous user -
when session timeout, redirect login page. need that, whether login user name same user name, logged in before session timeout, page redirect previous user visited page login page.
for example,
user name admin, when user open contactus.jsp, after session timeout page redirect login.jsp, in login.jsp whether same admin user logged in then, page redirect contactus.jsp instead of home.jsp.
thanks in advance.
one way of achieving using cookies.
but best way below one.
if using db in application can in below way:
create table in db fields
ip address
,user name
,last visited page
.when user performs
login
, insert values table.when user performs
logout
or whensession time out occurs
, update table , setlast visited page
current jsp name.again @
login
, before inserting row in table, make check onip address
. if row present currentip address
, ifuser names
match, retrievelast visited page
value table , forward user jsp page.
Comments
Post a Comment