For example, Struts has the following actions, and manageruseraction has the corresponding method.
< Action Name = "Adduser" Class = "Com. netshuai. Action. manageruseraction" Method = "Add" >
< Result Name = "Success" > /Adduser. jsp </ Result >
</ Action >
< Action Name = "Deluser" Class = "Com. netshuai. Action. manageruseraction" Method = "Del" >
< Result Name = "Success" > /Deluser. jsp </ Result >
</ Action >
< Action Name = "Updateuser" Class = "Com. netshuai. Action. manageruseraction" Method = "Update" >
< Result Name = "Success" > /Updateuser. jsp </ Result >
</ Action >
If you use wildcards, You can omit them as an action.
< Action Name = "* User" Class = "Com. netshuai. Action. manageruseraction" Method = "{1 }" >
< Result Name = "Success" > /{1} user. jsp </ Result >
</ Action >
* Is a wildcard and {1} is replaced by *. For example, the user accesses adduser. * is automatically replaced with ADD, and {1} is also replaced with ADD.
If Uniform Naming rules are used during development, all actions can be replaced with one similar to the following. < Action Name = "*_*" Class = "Com. netshuai. Action. {1} action" Method = "{2 }" >
< Result Name = "Success" > /{2} _ {1} success. jsp </ Result >
</ Action >
As shown above, all files adopt Uniform Naming rules. The first * is the classification name, and the second * is the operation name, {1} and {2} represent the replacement values of the first and second * respectively. All Action Implementation classes are named classification names + actions.
For example, if the category name is user and the operation name is add, the accessed action name is user_add.action, the implementation class name is useraction, And the return Page name is add_usersuccess.jsp.
In addition, {0} indicates that all Wildcards are displayed, as shown in figure < Result Name = "Success" > /{2} _ {1} success. jsp </ Result > Change < Result Name = "Success" > /{0} success. jsp </ Result >, The returned name is user_addsuccess.jsp.