[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: how to use Advanced wildcards Mounir Benzid Fri Feb 03 18:01:32 2012

Hi Maurizio,

first let me sincerly thank you for fixing this issue [1]. It works like a charm now. Wondering why nobody else had a similar problem.... maybe the majority is opting for the rest-plugin?

Anyway there's still a small issue regarding the redirectAction though.

After calling the parametrised actionName

<result name="success" type="redirectAction">
<param name="actionName">display/{1}/{2}</param>

the URL gets cluttered with the now redundant parameters (action & eventId) and there's still an extra ".action" attached to it as well.

like in http://localhost:8080/myEvents/display/edit/150.action?action=edit&eventId=150

That's the kind of URL signature that I'd like to avoid.

Is there a way to circumvent this?

Thank you again.
- Mounir

[1] https://issues.apache.org/jira/browse/WW-3747?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Am 25.01.2012 10:24, schrieb Maurizio Cucchiara:
I played with regex pattern and I realized that the example provided in
docs doesn't work [1].
Could you file an issue on jira [2]?

[1] http://struts.apache.org/
[2] https://issues.apache.org/jira/browse/WW

Maurizio Cucchiara

On 24 January 2012 10:34, Mounir Benzid<[EMAIL PROTECTED]>  wrote:


I'm having some trouble figuring out how to use the advanced wildcards
feature in struts II.

What I'm trying to do looks as follows

A)<action name="/event/modify/{action}/{eventId:[0-9]+}"
<interceptor-ref name="simpleStack" />
<result name="input">/WEB-INF/pages/myevents/createevent.jsp</result>
<result name="success" type="redirectAction">
<param name="actionName">/display/{action}/{eventId}</param>

B)<action name="/display/{action}/{eventId}" method="input"
<interceptor-ref name="simpleStack" />

There 2 issues with this

A) As long as I don't use any regexp patterns like [0-9]+ in the
configuration struts is happily matching the url against "EventAction"
http://blah/event/modify/edit/123 works perfectly fine.
Though in the above example the regexp in {eventId:[0-9]+} seems to prevent
http://blah/event/modify/edit/123 doesn't get resovled

B) I'm not able to use the same mechanics to redirectAction to another
action (say from A) to B).
I was hoping that "action" and "eventId" are automagically populated
through the value stack in A) and then then matching action B is called.

These are my constants btw:

<constant name="struts.enable.SlashesInActionNames" value="true"/>
<constant name="struts.mapper.alwaysSelectFullNamespace" value="false"/>
<constant name="struts.patternMatcher" value="regex" />

thanks a lot!
- Mounir

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]