Wildcard-2

Wildcard patterns can contain one or more of the following special tokens:

* Matches zero or more characters excluding the slash ('/') character.
** Matches zero or more characters including the slash ('/') character.
\character The backslash character is used as an escape sequence. Thus
'\*'

matches the character asterisk ('*'), and

'\\'

matches the character backslash ('\').

In the action mapping and action results, the wildcard-matched values can be accessed with the token {N} where N is a number from 1 to 9 indicating which wildcard-matched value to substitute. The whole request URI can be accessed with the {0} token.

Also, the action mapping and action result properties will accept wildcard-matched strings in their value attribute, like:

<action name="/edit/*" class="org.apache.struts.webapp.example.Edit{1}Action">
    <param name="id">{1}</param>
    <result>
      <param name="location">/mainMenu.jsp</param>
      <param name="id">{1}</param> 
    </result>
</action>

 See also Wildcard Method

猜你喜欢

转载自yaozuodaoforfly.iteye.com/blog/2084574