Question

Following http://struts.apache.org/2.2.3/docs/wildcard-mappings.html, below configurations work

Wildcard works

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

Regex works as well

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

But I failed to mix wildcard and regex in the action config like below:

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

When I access http-path-to-host/rs6k/drill/index, 404 error happens: There is no Action mapped for namespace [/] and action name [rs6k/drill/index] associated with context path [].

Can I mix regex and wildcard in struts.xml config?

Was it helpful?

Solution

Are you sure you have read all about wildcard-mappings?

<action name="/{group}/drill/{some}" class="example.DrillAction" method="{2}">
  <result name="success" type="freemarker">/drill-{2}.ftl</result>
</action>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top