You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Dean A. Hoover" <dh...@rochester.rr.com> on 2004/04/15 14:32:51 UTC

struts 1.1 and session handling

I am using struts 1.1 and tomcat 5 for
an application. I am also using DynaValidatorForm
for validation of form data. Here is my problem:
I want to test for (tomcat) session timeout and
output a message on the users brower stating that
their session timed out. I want to catch and process
this situation wherever it may occur. For example,
they log in and click on a menu item; right now
the first thing I do in the action for that menu item
is to see if the session is null, if it is I take appropriate
action; fine.

The problem I see is when the user gets a for up
where the validation is handled by a DynaValidatorForm.
It just merrily processes the form and shows validation
errors. This is especially problematic on a multiform
wizard that I created. If the user got to page 2, went out
to lunch, came back and wants to pick up where they
left off, they can't, because the page one stuff is not there
anymore.

I was thinking of writing a subclass of ForwardAction that checks
for the session before forwarding to the normal place. If the
session is not valid, it goes to some other specified place.
Any thoughts or suggestions?

Dean Hoover


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


Re: struts 1.1 and session handling

Posted by "Dean A. Hoover" <dh...@rochester.rr.com>.
I'll research that, thanks.

Doug wrote:

> How about servlet filters instead?  We've started using them for 
> things we want to handle for all URLs, outside of the normal 
> application logic, including session timeout.
>
> Dean A. Hoover wrote:
>
>> I am using struts 1.1 and tomcat 5 for
>> an application. I am also using DynaValidatorForm
>> for validation of form data. Here is my problem:
>> I want to test for (tomcat) session timeout and
>> output a message on the users brower stating that
>> their session timed out. I want to catch and process
>> this situation wherever it may occur. For example,
>> they log in and click on a menu item; right now
>> the first thing I do in the action for that menu item
>> is to see if the session is null, if it is I take appropriate
>> action; fine.
>>
>> The problem I see is when the user gets a for up
>> where the validation is handled by a DynaValidatorForm.
>> It just merrily processes the form and shows validation
>> errors. This is especially problematic on a multiform
>> wizard that I created. If the user got to page 2, went out
>> to lunch, came back and wants to pick up where they
>> left off, they can't, because the page one stuff is not there
>> anymore.
>>
>> I was thinking of writing a subclass of ForwardAction that checks
>> for the session before forwarding to the normal place. If the
>> session is not valid, it goes to some other specified place.
>> Any thoughts or suggestions?
>>
>> Dean Hoover
>
>
> ---------------------------------------------------------------------
> 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


Re: struts 1.1 and session handling

Posted by Doug <um...@myrealbox.com>.
How about servlet filters instead?  We've started using them for things 
we want to handle for all URLs, outside of the normal application logic, 
including session timeout.

Dean A. Hoover wrote:

> I am using struts 1.1 and tomcat 5 for
> an application. I am also using DynaValidatorForm
> for validation of form data. Here is my problem:
> I want to test for (tomcat) session timeout and
> output a message on the users brower stating that
> their session timed out. I want to catch and process
> this situation wherever it may occur. For example,
> they log in and click on a menu item; right now
> the first thing I do in the action for that menu item
> is to see if the session is null, if it is I take appropriate
> action; fine.
> 
> The problem I see is when the user gets a for up
> where the validation is handled by a DynaValidatorForm.
> It just merrily processes the form and shows validation
> errors. This is especially problematic on a multiform
> wizard that I created. If the user got to page 2, went out
> to lunch, came back and wants to pick up where they
> left off, they can't, because the page one stuff is not there
> anymore.
> 
> I was thinking of writing a subclass of ForwardAction that checks
> for the session before forwarding to the normal place. If the
> session is not valid, it goes to some other specified place.
> Any thoughts or suggestions?
> 
> Dean Hoover

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


Re: struts 1.1 and session handling

Posted by "Dean A. Hoover" <dh...@rochester.rr.com>.
I like that idea. But how does it address the
validator problem? I'm thinking I'm going to
have to pitch the DynaValidatorForm usage
and do something else.

Dean Hoover

Franz-Josef Herpers wrote:

> Dean A. Hoover wrote:
>
>> I am using struts 1.1 and tomcat 5 for
>> an application. I am also using DynaValidatorForm
>> for validation of form data. Here is my problem:
>> I want to test for (tomcat) session timeout and
>> output a message on the users brower stating that
>> their session timed out. I want to catch and process
>> this situation wherever it may occur. 
>
>
> We use a BaseAction class for this purpose. The class extends Action 
> and checks in its execute method that the session is still valid.
> At the and it calls another method of this class (we called that 
> method executeAction()). Of course every action then has to extend 
> this BaseAction class and override the executeAction() method.
>
> 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


Re: struts 1.1 and session handling

Posted by Franz-Josef Herpers <of...@fjh-consulting.de>.
Dean A. Hoover wrote:

> I am using struts 1.1 and tomcat 5 for
> an application. I am also using DynaValidatorForm
> for validation of form data. Here is my problem:
> I want to test for (tomcat) session timeout and
> output a message on the users brower stating that
> their session timed out. I want to catch and process
> this situation wherever it may occur. 

We use a BaseAction class for this purpose. The class extends Action and 
checks in its execute method that the session is still valid.
At the and it calls another method of this class (we called that method 
executeAction()). Of course every action then has to extend this 
BaseAction class and override the executeAction() method.

Regards
Franz

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