You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Juan Pablo Vagliati <jv...@poraire.net> on 2005/07/05 17:35:34 UTC

RE: Redirect request to home if session is expired

Hi,

I dont know if is a good design or exists other best practices for 
this scenario but that i have done is put a session attribute and test
in my
base action about it.

(sorry by my english)

bye, pablo.

-----Mensaje original-----
De: Franz-Josef Herpers [mailto:fjh@wir-age.de] 
Enviado el: MiƩrcoles, 06 de Julio de 2005 10:03 a.m.
Para: Struts Users Mailing List
Asunto: Redirect request to home if session is expired

Hi list members,

in my Struts-based application I want to test, if the session of the 
user is expired. If so, I want to forward/redirect the user back to the 
starting page. But this seems to be a problem, if I call an Action that 
is associated with an ActionForm in session scope. When I tried to test 
for an expired session with request.getSession(false) the session is 
never null, even if I monitor session destruction with a SessionListener

and can be sure the session is destroyed. As the source code of 
RequestProcessor suggests, this is because a new session is created, if 
the old is expired to put the ActionForm in this session. To get around 
this situation I associated the ActionServlet with a filter and did the 
testing for expired sessions there. This works. My remaining question 
is: Is this in any way a bad design or exists other best practices for 
this scenario? I'm surely not the only one who ran into this....

Thanks in advance for any hints.

Regards
Franz


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



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