| Author |
Session time out in Struts app
|
Raymond Miao
Greenhorn
Joined: Feb 26, 2004
Posts: 4
|
|
I am trying to define a general error page for session time out, when use type *.do I want to forward request to my predefined error page. I have defined isSessionTimeOut methed in my action parent class to check session status, and in each action class I have: if (isSessionTimeOut(request)) return mapping.findForward("error"); The problem is sometimes the action's execute method is not called as the validate method in ActionForm may return ActionErrors and request will be forwarded to the input page instead of my error page, has any one met this kind of situation before and had the solutions? Thanks.
|
 |
Srikanth Shenoy
author
Ranch Hand
Joined: Jan 24, 2004
Posts: 184
|
|
You might want to create your own RequestProcessor and override the processPreprocess() method. In that method put your check for Session time out and then invoke doForward(uri, request, response) with time out page and return false from that method. else return true. The Struts RequestProcessor calls the processPreprocess() in its process() method even before populating the ActionForm and doing other tasks like validation etc.. Hope this helps, Srikanth Shenoy [ February 27, 2004: Message edited by: Srikanth Shenoy ]
|
Srikanth Shenoy
Author of Struts Survival Guide : Basics to Best Practices
|
 |
calvin zhu
Ranch Hand
Joined: Mar 18, 2002
Posts: 54
|
|
just to say hello.
|
SCEA, SCJD, SCWCD, SCBCD, SCJP<br />IBM WebSphere Portal certification
|
 |
Raymond Miao
Greenhorn
Joined: Feb 26, 2004
Posts: 4
|
|
|
Thanks the RequestProcessor solution worked great!!
|
 |
Raymond Miao
Greenhorn
Joined: Feb 26, 2004
Posts: 4
|
|
|
Another benefit is now I have single control point and I don't have to check session status in each action classes.
|
 |
Srikanth Shenoy
author
Ranch Hand
Joined: Jan 24, 2004
Posts: 184
|
|
There ya go buddy. Glad that it worked well for you -Srikanth
|
 |
 |
|
|
subject: Session time out in Struts app
|
|
|