I think a hook into session creation would be good. I'd think the
scenario you describe would be pretty common. I know we did
pretty much what you describe for a non-struts based app. I wonder if
people are doing no session handling by overriding
processPreprocess() or perhaps in the action class?
I'm thinking it'd be nice to make the no session condition an event
that is generated by the ActionServlet and acted upon by any registered
listeners
(See "Event and Listener Model" on the 1.1 todo list).
That way, I could install a listener that handles the no session condition
by forwarding the user to some action forward without overriding
processSession(). The listener class to be registered could be
specified in the configuration file. It'd also be nice to be able to reuse
the same no session listener across multiple projects if they're all
doing the same thing (forwarding to some session timeout page).
Perhaps the default processSession() implementation would fire off
this event, so you could override the no session handling at the
processSession() function level, or by installing an event listener.
I don't know how far off the "Event and Listener Model" work is.
Perhaps we could put in a processSession() hook that does
nothing now, and look at making it generate an event later.
Andreas Prohaska wrote:
> 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
> ------------------------------------------------------------------------