Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.1.0
-
None
-
None
-
Operating System: All
Platform: All
-
30292
Description
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: <input type="hidden" name="preview"/> )</li>
- <li>There is no need for the developer to override any abstract method</li>
- </ul>
- @author Jean-Baptiste Nizet
*/
Attachments
Attachments
Issue Links
- is depended upon by
-
STR-2457 Provide better support for dialogs; avoid POSTDATA situations
- Closed