Can you use regular expressions in struts-config.xml?

Posted by rquinn on Stack Overflow See other posts from Stack Overflow or by rquinn
Published on 2011-02-04T23:20:42Z Indexed on 2011/02/04 23:25 UTC
Read the original article Hit count: 220

Filed under:
|
|

I'm trying to route these two url's to different Actions. We are using Struts 1.2: /abc-def/products /abc-def

I tried putting this action first:

<action path="/abc*/products" type="com.business.exampleAction">
    <forward name="success" path="/go"/>
</action>

and then this one after:

<action path="/abc*" type="com.business.differentExampleAction">
    <forward name="success" path="/goElsewhere"/>
</action>

but it always goes to the second action (differentExampleAction in this case). I've tried various iterations for the , like . or (.*), but haven't found anything that actually works yet.

From what I've read, it seems like the only regular-expression-like characters allowed in struts-config are the wildcard symbols (* and **), but I hope I am wrong.

© Stack Overflow or respective owner

Related posts about java

Related posts about struts