Why not just add a property to your form bean to detect this? Then you can
do the following:

- When the bean is constructed, the 'valid' property is set to false.
- When the action sets up the bean for display, it sets 'valid' to true.
- The JSP checks the 'valid' property before using the values from the form
bean.

This way, if the form bean is created by Struts, but not populated by your
action, the 'valid' property will be false, thus detecting the situation you
described.

Hope this helps.

--
Martin Cooper


----- Original Message -----
From: "Andreas Prohaska" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 06, 2001 4:15 AM
Subject: Handling session timeouts


>
> This was originally posted to the struts-user list, but Ted Husted pointed
> out that I should better discuss this on the development list.
>
> For the guys that are not listening to the user list, the background: We
> have written a wizard for a larger input process that requires some steps.
> We use one ActionForm bean for this wizard that keeps the data in the
> session context (everything done by struts). When I wanted to go to the
next
> step I recognized that all my data from the previous steps was lost and
> instead I had the default values. Obviously a session timeout occured and
> the original ActionForm was removed. Then a new session was automatically
> created and a new ActionForm bean was automatically added to the session
> context. Normally this is nice, but there was no way for my Action class
or
> JSP to see that in fact the session was lost and the data was wrong.
>
> Now I would recommend to place a method like processSession() at the start
> of the process() method in the ActionServlet. This could be changed by
> subclasses of the ActionServlet in order to intercept session creation and
> deprecation. OR it should call some more specialized class for this (say
> SessionManager). The advantage of this approach would be that we could
also
> introduce a new <page:init> tag that calls the same class in order to
> intercept session creation in JSP pages (that might be called directly).
>
> If the list decides that this could be nice, I would make the changes but
> then I need to know how I can submit them :-)
>
> What do you think?
>
> Andreas
>
> ------------------------------------------------------------------------
> Andreas Prohaska                          Mail: [EMAIL PROTECTED]
> Apeiron GmbH                              Tel : +49 (089) 278257-40
> Hohenzollernstr. 81                       Fax : +49 (089) 278257-49
> 80796 Muenchen
> ------------------------------------------------------------------------


Reply via email to