在Struts2 Struts.xml中混合正则和通配符



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>

Regex Works也有效

<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-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 config?

中混合正则和通配符

您确定您已经阅读了有关通配符示意的全部内容吗?

<action name="/{group}/drill/{some}" class="example.DrillAction" method="{2}">
  <result name="success" type="freemarker">/drill-{2}.ftl</result>
</action>

最新更新