You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Andrew Hill <an...@gridnode.com> on 2003/06/02 15:49:12 UTC

RE: RequestProcessor.processPopulate happens more than once when one Struts action forwards to another

Thats actually the expected behaviour and its because you are doing what is
known as 'action chaining'.
Its generally discouraged for reasons such as that you mention.

This topic has been discussed recently actually, so if you do a search of
the archive on "action chaining" you should be able to follow the
discussions we had about it. Someone had actually implemented a class
designed to facilitate action chaining , but I cant remember where to find
it. Anyhow should be in the archive.


-----Original Message-----
From: Ahearn, Denis [mailto:DENISA@firepond.com]
Sent: Monday, 2 June 2003 21:43
To: 'struts-user@jakarta.apache.org'
Subject: RequestProcessor.processPopulate happens more than once when
one Struts action forwards to another


Hi,

When one Struts action forwards to another Struts action, and the first
action was invoked by a form post, is it correct behavior that the
RequestProcessor.processPopulate method is called when the second action is
processed?  It seems to me that the form should only be populated from the
request parameters during the initial action, and not by each subsequent
action.

The current behavior causes me problems because I manually set some values
into the form in the first Struts action, and then forward to the second
action to save the form to a database.  The problem is, when the second
action is processed, the initial form values are set back into the form,
overwriting the changes made in the first action.

I was able to work around this problem by extending
RequestProcessor.processPopulate and checking for a custom property on the
action mapping which determines if the form should be populated or not.
This works, however it seems to me that the real problem is that Struts
populates the form for each Struts action that is being forwarded to.

Thanks,
Denis


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