<Action name = "*/*" method = "{3}" class = "com. Struts. Actions. {1}. {2} action"> <Result name = "View">/{1}/update {2}. jsp </result> <Result name = "list">/{1}/list. jsp </result> </Action> |
In the action name, each Asterisk is a wildcard. In this example, we use asterisks, which is not required. For example, if you want to map all the view actions on the object together, the configuration similar to "name ="/*/view * "can meet the requirements. Identifiers such as {1} and {2} are used to obtain the values corresponding to the wildcard (numbers indicate the positions of the wildcard corresponding to the values to be obtained, in the left-to-right order ).
In the "struts. properties" file (or use the "struts. xml" constant tag), make sure that the following attributes are correctly configured:
Struts. Enable. slashesinactionnames = true
After this attribute is set to true, a slash can be used in the action name. The default setting of struts2 does not allow a slash in the action name. You need to use a package to split the namespace.