Wrong URL match in action mapping(动作映射中的错误 URL 匹配)
问题描述
<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 与此操作匹配?
Why localhost:8080/partner/partnerName matches with this action?
推荐答案
试试 <constant name="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.
这篇关于动作映射中的错误 URL 匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:动作映射中的错误 URL 匹配
基础教程推荐
- 验证是否调用了所有 getter 方法 2022-01-01
- 多个组件的复杂布局 2022-01-01
- 不推荐使用 Api 注释的描述 2022-01-01
- 如何在 Spring @Value 注解中正确指定默认值? 2022-01-01
- 大摇大摆的枚举 2022-01-01
- 从 python 访问 JVM 2022-01-01
- Java Swing计时器未清除 2022-01-01
- 在 Java 中创建日期的正确方法是什么? 2022-01-01
- 如何在 JFrame 中覆盖 windowsClosing 事件 2022-01-01
- Java 实例变量在两个语句中声明和初始化 2022-01-01
