GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  J2EE  >  Struts

 Print  |  
Question:  how do you identify user session has been ended (at a particular time ) and forward a page to login page automatically



September 09, 2009 08:23:53 #4
 coolsiva   Member Since: September 2008    Total Comments: 2 

RE: how do you identify user session has been ended (at a particular time ) and forward a page to login page automatically
 
if(request.getRequestedSessionId() == null)
{
//user requesting for new session
//forward to loging page..
}
else if (!request.isRequestedSessionIdValid())
{
//user requesting for invalidated session so forward him to application session expiration page or //forward hime the login form again.
}
else(request.isRequestedSessionIdValid()){
    //forward him to the requested page.
}


add these code in any of the method like processActionPerform .. or any other method which overrides the controller or we can put in any of the filter..



     

 

Back To Question