I have a Bean like this
private String projectName;
private String projectCode;
It contains valid getter and setter.
Inside my Action class I am returning this as List and further passing on to JSP to be shown.
<select class="ibm-styled" name="selectedProjects" id="selectedProjects"
multiple="multiple" tabindex="1">
<s:iterator value="projectList">
<option value="<s:property value='projectCode' />">
<s:property value="projectName"/>
</option>
</s:iterator>
</select>
In My Action, I have this selectedProjects
value and its getter setter defined.
And there I am converting selectedProjects
that contains projectCode
part of Bean into projectName
And I have setted into a String selectedProjectName
with valid getter setter
So, Now I have two values in my action class, One set by JSP named selectedProjects
and another set by me selectedProjectName
.
private String selectedProjects = null;
private String selectedProjectName= null;
I tested it, I am able to print them both from action class on console. Now comes the real problem....I need to call another Action via action chaining and pass both parameters their
<action name="reports" class="com.ibm.succession.tool.actions.Reports" method="generateReport">
<result name="tsrep">/TenuredSummary.jsp</result>
<result name="strprep" type="chain">
<param name="actionName">displaySkillReport</param>
<param name="selectedProjects">${selectedProjects}</param>
<param name="selectedProjectName">${selectedProjectName}</param>
</result>
</action>
And its action like this
<action name="displaySkillReport" class="com.ibm.succession.tool.actions.SkillTypeReportAction">
<result name="success">/skillTypeResoucePlan.jsp</result>
</action>
Now, In SkillTypeReportAction
I have again both two values with getter and setters
private String selectedProjects = null;
private String selectedProjectName= null;
But When I am trying to use it there.....selectedProjectName
is coming blank but the other one is working fine.
Can someone shed some light on this, Let me know if need any further details.
If you want to pass parameters between actions than instead of type=chain
you should use <result type="redirectAction">
<action name="reports" class="com.ibm.succession.tool.actions.Reports" method="generateReport">
<result name="tsrep">/TenuredSummary.jsp</result>
<result name="strprep" type="redirectAction">
<param name="actionName">displaySkillReport</param>
<param name="selectedProjects">${selectedProjects}</param>
<param name="selectedProjectName">${selectedProjectName}</param>
</result>
</action>
for Struts 2.2
<result type="redirectAction">
for Struts 2.0
<result type="redirect-action">
Also comment if this does not work for you.