【发布时间】:2012-11-02 13:26:59
【问题描述】:
按照http://struts.apache.org/2.2.3/docs/wildcard-mappings.html,以下配置工作
通配符作品
<action name="/drill/*" class="example.DrillAction" method="{1}">
<result name="success" type="freemarker">/drill-{1}.ftl</result>
</action>
正则表达式也可以
<action name="/{group}/drill/index" class="example.DrillAction" method="index">
<result name="success" type="freemarker">/drill-index.ftl</result>
</action>
但我未能在操作配置中混合通配符和正则表达式,如下所示:
<action name="/{group}/drill/*" class="example.DrillAction" method="{1}">
<result name="success" type="freemarker">/drill-{1}.ftl</result>
</action>
当我访问 http-path-to-host/rs6k/drill/index 时,发生 404 错误:There is no Action mapped for namespace [/] and action name [rs6k/drill/index] associated with context path [].
我可以在 struts.xml 配置中混合使用正则表达式和通配符吗?
【问题讨论】:
标签: regex struts2 action-mapping