On 7/28/05, Werner Punz <[EMAIL PROTECTED]> wrote:
> Actually I was thinking also along the lines of having some kind of
> garbage collecting mechanism.
> I did something like that in JSF very easy (reprogrammed parts of the
> x:saveState)
> the trick was to push the object into the session with some kind of key
> which stores the current and the old session and at the end of each
> rendering cycle (which is the problem because struts behaves totally
> different)
> 
> 
> I basically dumped the objects from the old url and pushed the newly
> registrated ones into the central object storage.
> 
> That trick worked very well, because you have clear distinctive phases
> in JSF which mark the before assigning the data part and the after
> rendering part of the request and you already have a save and restore
> mechanism on component level which utilizes those two phases.

You can do the same in Struts. Well, in Struts Dialogs ;-) which like
JSF also has distinctive phases and stores state on server. Actually,
I am going to implement this feature.

The idea is that an action is a web resource. An action can have
multiple states and can reder different pages. The fact that action
mapping can have only one corresponding action form, works pretty
well. I stick all data that I use in a resource, into action form and
set form scope to "session". Then I can have a wizard (controlled by a
single action), or a login/logout component. Once I leave that action,
I can simply remove the action form from the session.

I will have to define subsession groups, and each action mapping would
be able to participate in one or more subsessions. Once I leave a
subsession, I can remove an action form with all its corresponding
data.

On a side note, I cannot get why storing data in an action form is
considered wrong, while directly accessing session is OK. I think
quite opposite. I prefer to stick data related to an action, into
action form. It is more controlled, more visible, and then I can
simply remove one action form object from the session to clear the
whole tree.

Michael.

--
Struts Dialogs
http://struts.sourceforge.net/strutsdialogs

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to