[ http://issues.apache.org/struts/browse/STR-2142?page=all ]
     
David Evans closed STR-2142:
----------------------------

    Resolution: Fixed

> Replacement of LookupDispatchAction
> -----------------------------------
>
>          Key: STR-2142
>          URL: http://issues.apache.org/struts/browse/STR-2142
>      Project: Struts Action 1
>         Type: Improvement

>   Components: Extras
>     Versions: 1.1 Final
>  Environment: Operating System: All
> Platform: All
>     Reporter: Jean-Baptiste Nizet
>     Assignee: David Evans
>     Priority: Minor
>  Attachments: ParameterDispatchAction.java, ParameterDispatchAction.java, 
> SelectAction.java, SelectAction.java, SelectAction.java, SelectAction.java, 
> SelectAction.java, SelectAction.java, SelectAction.java, 
> strings_properties_patchfile.txt
>
> LookupDispatchAction is useful as a DispatchAction when you have multiple
> buttons on the same form. However, I think another powerful way to solve this
> problem could be used: select a method from a list defined in the mapping
> parameter attribute by checking the presence of o request parameter name.
> See the following cut'n pasted javadoc for details, and see the following
> attachment for an implementation.
> /**
>  * This class has the same goal as the DispatchAction: select the appropriate
>  * method to execute based on a request parameter. The way to determine which 
>  * method to call works in a different way, though. The parameter attribute 
> of 
>  * the mapping contains a list of method names. If one of the request 
> parameters
>  * has the same name as one of the method names specified in the list of 
> method
>  * names, this method is executed. If none of the request parameters has one
>  * of the method names, the unspecified method is invoked. <br />
>  * This class has the same goal and utility as the LookupDispatchAction: it 
>  * allows having several submit buttons on the same form. All that is needed 
> with
>  * this class is to give each button a different name (example: preview/post).
>  * It's more powerful than the LookupDispatchAction for several reasons, 
> though:
>  * <ul>
>  *   <li>The submit buttons don't need to be declared in the various 
>  *       internationalized ApplicationResources.properties files (useful if 
> JSTL
>  *       tags are preferred to the Struts tags)</li>
>  *   <li>It's more performant</li>
>  *   <li>Two submit buttons may have the same text</li>
>  *   <li>Links can easily use this kind of action as well as buttons
>  *       (ex: doThis.do?preview=&subject=...)</li>
>  *   <li>Hidden fields may easily be used to select the method 
>  *       (ex: &lt;input type="hidden" name="preview"/&gt; )</li>
>  *   <li>There is no need for the developer to override any abstract 
> method</li>
>  * </ul>
>  * @author Jean-Baptiste Nizet
>  */

-- 
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


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

Reply via email to