Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Duplicate
-
1.1 RC1
-
None
-
None
-
Operating System: All
Platform: All
-
19802
Description
This has come up before (http://nagoya.apache.org/eyebrowse/ReadMsg?
listName=struts-user@jakarta.apache.org&msgId=149281), but is close to a bug
and I request that it be considered for a future fix (should be easy).
REQUEST
The request is that an additional param be added to the ActionMapping to
specify if reset/populate should be invoked, very much like the existing
validate param is used.
RATIONALE
When the ActionMapping configuration specifies both an ActionForm and an
Action, then the RequestProcessor always calls reset() on the ActionForm and
then populates it from the request params. This is ideal for an
ActionForm/Action combo that is processing input from an HTML form. However,
when an Action is called to populate an ActionForm prior to displaying the
HTML form, it is incorrect. Attributes of the ActionForm may be populated
from the request even though the request does not relate to the current form.
At best this is unnecessary processing, at worst it leads to bugs when there
are accidental matches between request param names and ActionForm methods
(which is how I found this).
Using separate actions for setting up output and processing input does not
solve this problem unless the "output" ActionMapping does not specify a form.
Since the purpose of the Action is to populate the ActionForm, this is
undesirable. It is possible to omit the form name from the ActionMapping and
then explicitly retrieve the appropriate ActionForm using code in the Action,
but this defeats the purpose of using a config definition. There are other
workarounds that are "klugey" but the best solution is to add the
ActionMapping parameter.
Thanks for considering this.
Carl Hope
Attachments
Issue Links
- is duplicated by
-
STR-1116 ActionForm reset strategy
- Resolved