Re: Action chaining not forwarding ModelDriven model properties
On 2/28/2018 3:47 PM, shahzad.ismail@ wrote: > 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. AFAIR the chain result doesn't set destination action props from request, but in your case, it calls action1.getModel() and gets the object then calls action2.setModel(the object). Could you try these and see what happens: 1. Via your browser, browse action2 directly (instead of action1). 2. Try different configs like action2->action3->action1, or action3->action1->action2, or action2->action1->action3, or action3->action2->action1. Regards.
Re: Action chaining not forwarding ModelDriven model properties
Can you share a source code of your actions? 2018-02-28 13:17 GMT+01:00 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: > > > > > > name="exception.logEnabled">true > DEBUG > name="params.excludeParams">dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,parameters\...* > > > > > > > And I'm using them as: > > > > * > insert > * > insert > > kmList_actionmethod2 > kmList_actionmethod3 > > actionmethod1, actionmethod2, actionmethod3 > > > > 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
Action chaining not forwarding ModelDriven model properties
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: true DEBUG dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,parameters\...* And I'm using them as: * insert * insert kmList_actionmethod2 kmList_actionmethod3 actionmethod1, actionmethod2, actionmethod3 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