动作映射中的网址匹配错误 [英] Wrong URL match in action mapping
问题描述
<action name="/partner/*/*" class="webStoreAction">
<param name="saveUrl">true</param>
<param name="homeName">HomePartner</param>
<param name="partner">{1}</param>
<param name="partnerId">{2}</param>
<param name="homeFromMenu">false</param>
<result name="success" type="jsf">
/WEB-INF/pages/load.xhtml
</result>
</action>
为什么 localhost:8080/partner/partnerName
与此操作匹配?
推荐答案
尝试<常数名="struts.patternMatcher";value ="regex"/
是以上常量的唯一可行的匹配器.此处解释说,这通常与高级通配符模式一起使用.
Try <constant name="struts.patternMatcher" value="regex"/>
the only viable matcher for the constants above. This is usually used with advanced wildcards mode, explained here.
高级通配符从2.1.9+开始,可以在操作名称中定义正则表达式.要使用这种形式的通配符,必须设置以下常量:
Advanced Wildcards From 2.1.9+ regular expressions can be defined defined in the action name. To use this form of wild card, the following constants must be set:
<constant name="struts.enable.SlashesInActionNames" value="true"/>
<constant name="struts.mapper.alwaysSelectFullNamespace" value="false"/>
<constant name="struts.patternMatcher" value="regex" />
URL分为名称空间/
和操作名称 partner/partnerName
.最后一个匹配的模式是使用默认映射器通配符映射器根据操作配置中的名称编译的模式.
The URL splitted into namespace /
and action name partner/partnerName
. The last matches a pattern compiled from the name in the action config using a wildcard mapper, which is a default mapper.
这篇关于动作映射中的网址匹配错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!