struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From HENRY Pierre <>
Subject Chaining actions specifying method name
Date Tue, 05 May 2009 14:30:54 GMT

I am new to Struts2 but after struggling a couple of weeks with the doc (hard to find up-to-date
doc for 2.1.6) and a couple out-of-date books, I am really starting to appreciate the simplicity
and flexibility !

I am using Struts 2.1.6.

I have built a SecurityInterceptor, which checks authentication and permissions of the user,
in particular if the invocated action is authorized, based on the action name. The action
name is read using :


I also tried 


In general, invocation.getProxy().getActionName() returns the name of the action, and as I
use the action!method pattern in the URL I could also get the method from getMethodName().

But then I have a navigation menu action which chains to the selected action. The properties
nextAction and nextNamespace are properties from the MenuSelectAction :

<action name="Menu" class="my.MenuSelectAction" >
   <result type="chain" name="success">
     <param name="actionName">${nextAction}</param>
     <param name="namespace">${nextNamespace}</param>

It works fine but there is no "methodName" parameter possible for the chain result, so I have
to put the litteral "myAction!method" in the nextAction property. Then the right action with
the right method is invocated, but in my interceptor the 


method returns "myAction!method" and the authorization check fails because it should be looking
only for "myAction".

So we have two different behaviours, depending if the action was chained or invocated directly.

This is not so bad for me and I can easily find a work-around, but it might be worth it to
add a "methodName" parameter to the chain type result, and then to invoke the action in the
same manner than when it is invoked directly ?

Cheers and thanks for the good work !

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message