[ 
http://issues.apache.org/struts/browse/STR-1116?page=comments#action_38042 ] 
            
Michael Jouravlev commented on STR-1116:
----------------------------------------

This change request (CR) is not about automatic call of the reset() method, it 
is about being able to figure out whether an action mapping being called is 
chained or not. Setting something like reset="false" in action mapping ties the 
mapping to a particular usage, like always being a chained action. This may 
bite later when mappings are redesigned for a new version.

The simpler thing to to is to create a token and to check its presense in 
request object. If the token is not there, then action is the first in the 
chain, put the token into the request. If the token is there, then action is 
chained. Token does not have to be removed since request object is disposed of 
automatically.

Such a "chain-detect token" can be implemented in the Struts core.

> Configure if you want to call ActionForm.reset() in <action> element in 
> struts-config.
> --------------------------------------------------------------------------------------
>
>                 Key: STR-1116
>                 URL: http://issues.apache.org/struts/browse/STR-1116
>             Project: Struts 1
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: Nightly Build
>         Environment: Operating System: All
> Platform: All
>            Reporter: Jan Cumps
>         Assigned To: Struts Developers
>            Priority: Minor
>             Fix For: Future
>
>
> New attribute in <action> element where you can flag if you want the 
> framework 
> to call the reset() function of the ActionForm .
> It's very much like the "validate" attribute already present.
> This attribute would default to "true" for backward compatibility.
> Rationale:
> If you use checkboxes, you need to set the corresponding ActionForm property 
> to "false" before the bean is populated from the request attributes (in the 
> reset() method).
> But when you chain actions , you don't want this to happen (you would loose 
> information).You want your bean to keep the info.
> Example:
> traceopen calls tracedetail on success -> show tracedetail.jsp
> tracesave calls tracedetail when validation fails (input attribute) -> show 
> tracedetail.jsp
> tracedetail does some common things always needed for tracedetail.jsp 
> (eg.load 
> values for <select> tag from model). 
> It should receive the ActionForm in the state it was in the calling action.
>     <!-- Process a trace open for a new or existing trace -->
>     <action    path="/trace/traceopen"
>                type="org.blabla.TraceOpenAction"
>                name="traceForm"
>                scope="request"
>                reset="true">
>       <forward name="success"              path="/trace/tracedetail.do"/>
>       <forward name="failure"              path="/index.jsp"/>
>     </action>
>     
>     <!-- prepare tracedetail.jsp resources -->
>     <action    path="/trace/tracedetail"
>                type="org.blabla.TraceDetailAction"
>                name="traceForm"
>                scope="request"
>                reset="false">
>       <forward name="success"              path="/trace/tracedetail.jsp"/>
>       <forward name="failure"              path="/index.jsp"/>
>     </action>
>  
>     <!-- Process a trace save -->
>     <action    path="/trace/tracesave"
>                type="org.blabla.TraceSaveAction"
>                name="traceForm"
>                scope="request"
>                reset="true">
>                input="/trace/tracedetail.do">
>       <forward name="success"              path="/trace/tracelist.do"/>
>       <forward name="cancel"               path="/trace/tracelist.do"/>
>     </action>
> note:
> Can all be done by overriding ActionConfig.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to