Monday, July 21, 2014

Struts 1.1 forward to another action with additional paramenters

Yeah yeah I know you must be smiling by looking at this blog post in 2014 and thinking who still posts about STRUTS :).

Well it's a person who is supporting an applicaiton built on Struts ;).

Problem Statement

Ok so I had this problem where I wanted to forward to another Action from my current action and also I wanted to send some extra attributes

Solution

In my Action class I had to create my own ActionForward Object like below and return it



ActionForward actionRedirect = new ActionForward("/pages/myAction.do"+ "?reportType=someReport&someValue="+myBean.getSomeValue(), true);

return actionRedirect; Now I am able to forward to myAction and the form bean in populated with the values I am sending as request parameters.

No comments:

Post a Comment