`
yaozuodaoforfly
  • 浏览: 119037 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

Wildcard-6

 
阅读更多

The regular expression can also be in the form {FIELD_NAME:REGULAR_EXPRESSION}. The regular expression is a normal Java regular expression. For example:

<package name="books" extends="struts-default" namespace="/">
    <action name="/{type}/{author:.+}/list" class="example.ListBooksAction">
	<result>/books/list.jsp</result>
    </action>
</package>

In this example, if the url /philosophy/AynRand/list is requested, ListBooksAction's field "type" will be set to "philosophy" and "author" to "AynRand".

The matched groups can still be accessed using the {X} notation, like:

<package name="books" extends="struts-default" namespace="/">
    <action name="/books/{ISBN}/content" class="example.BookAction">
	<result>/books/{1}.jsp</result>
    </action>
</package>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics