You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Martin Gainty <mg...@hotmail.com> on 2009/05/06 21:44:51 UTC

RE: Struts 2 – changing method signature


take a look at com.opensymphony.xwork2.interceptor.ParametersInterceptor

This interceptor gets all parameters from ActionContext.getParameters() and sets them on the value stack by
 calling ValueStack.setValue(String, Object), typically resulting in the values submitted in a form
 request being applied to an action in the value stack. Note that the parameter map must contain a String key and
 often containers a String[] for the value.
The interceptor takes one parameter named 'ordered'. When set to true action properties are guaranteed to be
 set top-down which means that top action's properties are set first. Then it's subcomponents properties are set.
/*so it takes all the context params and puts it onto VS*/

the ParametersInterceptor is referenced via
<interceptor name="params" class="com.opensymphony.xwork2.interceptor.ParametersInterceptor"/>
by params which is already referenced from basicStack e.g.
         <interceptor-stack name="basicStack">
                <interceptor-ref name="exception"/>
                <interceptor-ref name="servletConfig"/>
                <interceptor-ref name="prepare"/>
                <interceptor-ref name="checkbox"/>
                <interceptor-ref name="actionMappingParams"/>
                <interceptor-ref name="params">
                    <param name="excludeParams">dojo\..*,^struts\..*</param>
                </interceptor-ref>
                <interceptor-ref name="conversionError"/>
            </interceptor-stack>

where the action references 'params' via interceptor-ref name e.g.
   <package name="skill" extends="default" namespace="/skill">
        <default-interceptor-ref name="crudStack"/>
        <action name="list" class="org.apache.struts2.showcase.action.SkillAction" method="list">
            <result>/empmanager/listSkills.jsp</result>
            <interceptor-ref name="basicStack"/>
        </action>

http://struts.apache.org/2.0.14/struts2-core/apidocs/com/opensymphony/xwork2/interceptor/ParametersInterceptor.html

Martin 
______________________________________________ 
Disclaimer and Confidentiality/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
This message is confidential. If you should not be the intended receiver, then we ask politely to report. Each unauthorized forwarding or manufacturing of a copy is inadmissible. This message serves only for the exchange of information and has no legal binding effect. Due to the easy manipulation of emails we cannot take responsibility over the the contents.
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> Date: Wed, 6 May 2009 12:18:55 -0700
> From: cm132005@gmail.com
> To: user@struts.apache.org
> Subject: Struts 2 – changing method signature
> 
> 
> In Struts 2, is DefaultActionInvocation invokeAction responsible for invoking
> the action methods and what would be a good approach to change all action
> method signature to have a fixed number of parameters? 
> 
> For regular actions, I implemented a BaseAction class with an abstract
> method and having the execute() call this new executeImpl(RequiredParam
> param) but not sure how this can be done for the methods in Dispatch
> Actions. In Struts 1, one could change the signature for methods in dispatch
> actions by overriding the DispatchAction getMethod and dispatchMethod
> methods. 
> 
> The requirement is to have one parameter passed in all action methods
> whether that be execute() or any other. Any help would be greatly
> appreciated. 
> 
> Thanks.
> 
> -- 
> View this message in context: http://www.nabble.com/Struts-2-%E2%80%93-changing-method-signature-tp23413593p23413593.html
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

_________________________________________________________________
Hotmail® has a new way to see what's up with your friends.
http://windowslive.com/Tutorial/Hotmail/WhatsNew?ocid=TXT_TAGLM_WL_HM_Tutorial_WhatsNew1_052009