Wildcard Mappings
来源:互联网 发布:Java读取本地文件时间 编辑:程序博客网 时间:2024/06/08 13:15
The best way to explain wildcards is to show an example and walk through how it works. This example modifies a conventional mapping to use wildcards to match all pages that start with /edit:
<!-- Generic edit* mapping --><action name="/edit*" class="org.apache.struts.webapp.example.Edit{1}Action"> <result name="failure" path="/mainMenu.jsp"/> <result path="/\{1\}.jsp"/></action>
The "*" in the path attribute allows the mapping to match the request URIs /editSubscription, editRegistration, or any other URI that starts with /edit, however /editSubscription/add would not be matched. The part of the URI matched by the wildcard will then be substituted into various attributes of the action mapping and its action results replacing {1}. For the rest of the request, the framework will see the action mapping and its action results containing the new values.
Mappings are matched against the request in the order they appear in the framework's configuration file. If more than one pattern matches the last one wins, so less specific patterns must appear before more specific ones. However, if the request URL can be matched against a path without any wildcards in it, no wildcard matching is performed and order is not important.
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 properties (set using the <set-property key="foo" value="bar"> syntax) will accept wildcard-matched strings in their value attribute.
Like the action mapping, the action result properties (set using the <set-property key="foo" value="bar"> syntax) will accept wildcard-matched strings in their value attribute.
from : http://struts.apache.org/2.0.6/docs/wildcard-mappings.html
- Wildcard Mappings
- Struts2 通配符映射(wildcard mappings) 多个请求一个action处理
- wildcard
- Wildcard
- wildcard
- Nested Mappings
- Servlet Mappings
- Handler mappings
- ES mappings
- Using Data Table Mappings
- 继承映射(Inheritance Mappings)
- struts之action mappings
- struts global-exception-mappings
- Keystroke mappings in WebMatrix
- <action-mappings > 属性详解
- NERD tree Mappings
- [ElasticSearch] mappings and type
- Association Mappings between Entities
- 【C++ 学习笔记】:STL-multimap
- 根据字符 删除 可变数组、字符串 中的信息
- 如何提高google adwords质量得分
- Fedora11下找回/dev/dsp设备
- How to install maven in Flash Builder 4.5
- Wildcard Mappings
- Linux音频编程指南 一
- 开启和关闭服务器代理(php)
- 网络流最大流最小割算法
- Linux音频编程指南 三
- Linux音频编程指南 二
- ubuntu-server下安装mysql、tomcat、jdk
- Oracle ADF PPR属性的疑问
- 关于单一职责原则的一点理解