...
Another common approach is to " postfix " the method name and set it off with an exclamation point (aka "bang") or other special character.
- "action=Crud!input"
- "action=Crud!delete"
To use this sort of referencea postfix-bang idiom, just move the asterisk and add a bang.
Code Block | ||||
---|---|---|---|---|
| ||||
<action name="Crud!*" class="example.Crud" method="{1}">
|
From the framework's perspective, a wildcard mapping creates a new "virtual" mapping with all the same attributes as a conventional, static mapping. As a result, you can use the expanded wildcard name as the name of validation, type conversion, and localization files, just as if it were an Action name (which it is!).
Crud!input-validation.xml
Crud!delete-conversion.xml
...
The "!" notation is also available in WebWork 2, but it is implemented differently. To use the old implementation, set
...
struts.enable.DynamicMethodInvocation=TRUE
in the
...
struts.properties
file. To use wildcards instead (preferred), set
...
struts.enable.DynamicMethodInvocation=FALSE
.
ActionSupport Default
If the class attribute in an action mapping is left blank, the com.opensymphony.xwork.ActionSupport
class is used as a default.
...