[
https://issues.apache.org/struts/browse/STR-286?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Michael Jouravlev reopened STR-286:
-----------------------------------
Assignee: Michael Jouravlev (was: Craig McClanahan)
The original change request was valid. Reopening this request with intent to
fix.
With DRY principle in mind, the good practice for interactive web forms is
employing two two-mapping approach: one mapping for input, another mapping for
render. A separate action classes would correspond to each mapping (it is
possible to use only one action class). A render action can be either navigated
directly to display content corresponding to current action state, or it can be
forwarded to from the input action.
I personally prefer redirection to forwarding, therefore fixing this issue is
not a priority for my development. Still, I realize that many prefer using
forwarding to save on network roundtrip and to use request scope instead of
session.
Proposed approach for fixing this issue:
* when request comes, PopulateActionForm command should check whether request
object contains forward token. If not, populate form. If yes, check with action
mapping attribute/property whether form should be populated. If needed,
populate form.
* Another command, which will be called after PopulateActionForm, will set
forward token.
* No need to remove forward token because request object is destroyed
automatically after request handled.
* New attribute for action mapping: "populate" with possible values:
"onRequest", "onForward", "onRequest,onFoward". The latter is default to ensure
backward compatibility.
Simply omitting "name" attribute is not the same solution, because <html:form>
and other tags use form bean by default. Without having form bean, these tags
would need to contain explicit references to a form bean.
> Multiple calls to populate ActionForm
> -------------------------------------
>
> Key: STR-286
> URL: https://issues.apache.org/struts/browse/STR-286
> Project: Struts 1
> Issue Type: Bug
> Components: Core
> Affects Versions: 1.0 Final
> Environment: Operating System: All
> Platform: Other
> Reporter: aria.kiahaschemi
> Assigned To: Michael Jouravlev
>
> Within a sequence of Actions (with no intermediate user interaction), the
> ActionForm is populated with the request parameters' values each time the
> request is forwarded to the next Action. As a consequence, an Action B,
> following an Action A, will not 'see' the ActionForm in the state Action A
> left
> it in, but instead get as the ActionForm's properties' values, the
> parameters'
> values provided with the HTTP request. (I.e. Action B 'sees' in the
> ActionForm
> what, e.g., the user entered, instead of what Action A already did with it.)
> Suggestion to discuss:
> It might be cofigurable within the struts-config.xml to set an Action to
> either 'ActionForm_population_required' (default),
> or 'ActionForm_do_not_populate'.
> Thank you in advance for any response!
> Aria
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.