GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  J2EE  >  Struts
Go To First  |  Previous Question  |  Next Question 
 Struts  |  Question 87 of 103    Print  
how do you identify user session has been ended (at a particular time ) and forward a page to login page automatically

  
Total Answers and Comments: 4 Last Update: September 22, 2009     Asked by: vijayganesh mech 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
May 02, 2007 05:21:55   #1  
laks        

RE: how do you identify user session has been ended (a...
In the struts-config.xml you should have the entry success or failure. In the action class you should check if the session has timed out like if(session.timedOut true )
then ActionForward( success ) ;

 
Is this answer useful? Yes | No
April 02, 2009 14:26:16   #2  
raghavageek Member Since: December 2006   Contribution: 1    

RE: how do you identify user session has been ended (at a particular time ) and forward a page to login page automatically
HttpSession session request.getSession();
if (!session.isNew()) {
//continuee...
}
else {
//redirect to login page.
}

 
Is this answer useful? Yes | No
July 02, 2009 09:47:57   #3  
masarrat Member Since: July 2006   Contribution: 9    

RE: how do you identify user session has been ended (at a particular time ) and forward a page to login page automatically
I agree with raghavageek but if server is restarted then what? use listeners for same.
 
Is this answer useful? Yes | No
September 22, 2009 08:23:53   #4  
coolsiva Member Since: September 2008   Contribution: 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..




 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape