Can you share a source code of your actions?

2018-02-28 13:17 GMT+01:00 shahzad.ism...@gmail.com <shahzad.ism...@gmail.com>:
> Hi,
> I'm migrating an app from Struts 1 to Struts 2 (Tomcat v8 and Struts 
> 2.5.14.1). There is a scenario in which mapping goes like:
> jsp1 --> action1 --> action2 --> action3 --> jsp2
>
> So it must be type="chain" for action1 --> action2 and action2 --> action3 as 
> I need to pass ModelDriven model as well as some action member variables, 
> some of them are non-strings. All 3 actions are chaining to different methods 
> of the same action class.
> The **problem** is that action1 --> action2 is passing action variables but 
> not passing any properties of model even though action2 --> action3 is 
> passing all the action variables as well as model properties.
> I'm only using defaultStack of interceptor.
> My interceptors are defined as:
>
>     <interceptors>
>                         <interceptor-stack name="adssStack">
>                         <interceptor-ref name="logger" />
>                                 <interceptor-ref name="defaultStack">
>                                 <param 
> name="exception.logEnabled">true</param>
>                                 <param name="exception.logLevel">DEBUG</param>
>                                 <param 
> name="params.excludeParams">dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,parameters\...*</param>
>                                 </interceptor-ref>
>                     </interceptor-stack>
>                 </interceptors>
>                 <default-interceptor-ref name="adssStack" />
>
>
> And I'm using them as:
>
>     <action name="kmList_*" method="{1}" class="com.pkg.MyAction">
>          <interceptor-ref name="adssStack">
>             <param name="validation.excludeMethods">*</param>
>             <param name="validation.includeMethods">insert</param>
>             <param name="workflow.excludeMethods">*</param>
>             <param name="workflow.includeMethods">insert</param>
>         </interceptor-ref>
>         <result name="searchKM" type="chain">kmList_actionmethod2</result>
>         <result name="moveToList" type="chain">kmList_actionmethod3</result>
>         <allowed-methods>
>             actionmethod1, actionmethod2, actionmethod3
>         </allowed-methods>
>     </action>
>
> I've debugged it a bit and able to figure out that, initially, at the start 
> of action1, request.getParamater("modelprop") is null then I set modelprop in 
> the action1 method which makes mymodel.modelprop == "something" and 
> request.getAttribute("modelprop") == "something" but the 
> request.getParameter("modelprop") remains null by the end of action1 method. 
> So when it chains to action2 method, it simply rewrites 
> request.getParameter("modelprop") value, which is *null*, back to both, 
> request.getAttribute("modelprop") and mymodel.modelprop. Am I messing up with 
> some interceptor configuration?
> I've tried it with type="redirectAction" and the problem of not passing 
> mymodel.modelprop from action1 to action2 remains.
> Any suggestions would be appreciated.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to