You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2004/07/23 13:42:02 UTC
DO NOT REPLY [Bug 30292] New: -
Replacement of LookupDispatchAction
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30292>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=30292
Replacement of LookupDispatchAction
Summary: Replacement of LookupDispatchAction
Product: Struts
Version: 1.1 Final
Platform: All
OS/Version: All
Status: NEW
Severity: Enhancement
Priority: Other
Component: Standard Actions
AssignedTo: dev@struts.apache.org
ReportedBy: jbnizet@objetdirect.com
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
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org