You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by bhaarat Sharma <bh...@gmail.com> on 2008/05/08 18:17:34 UTC

Transfer user to login page on session timeout

Hello

I am using struts 1

I am working on some legacy code. Have a requirement where the user should
be fwded to the login page after session times out.  Currently there are
100's of action classes and it wont be feasible to touch each one and check
if the session exists.

Can we do something in struts 1 so that all requests go through the initial
action...there I can check for session object..if it does not exist then I
can forward it to the login page.

Thanks for any help!!

Re: Transfer user to login page on session timeout

Posted by Vivek Rana <vr...@allegromedical.com>.
Hi,

You should be able to use servlet filters to block the request from 
going to the actions:  http://java.sun.com/products/servlet/Filters.html

I would do it your way and check for timeout by checking for the 
presence of session objects.  There may be better ways, but I can't 
think of any other.  (A different way may be to check whether the 
session was started in this request.  I don't know how to do it in 
struts though and I don't see a reason why it would actually be 
advantageous to use that check.)

-Vivek.


bhaarat Sharma wrote:
> Hello
>
> I am using struts 1
>
> I am working on some legacy code. Have a requirement where the user should
> be fwded to the login page after session times out.  Currently there are
> 100's of action classes and it wont be feasible to touch each one and check
> if the session exists.
>
> Can we do something in struts 1 so that all requests go through the initial
> action...there I can check for session object..if it does not exist then I
> can forward it to the login page.
>
> Thanks for any help!!
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org