Home > Java > Passing Parameter(s) To Next Action

Passing Parameter(s) To Next Action

November 14th, 2008

Snippet from the struts.xml file. MyAction1 makes use of GenerateReportAction by passing to the latter 2 request parameters, sendCopyViaEmail & empId, both of which have corresponding getter and setter methods inside MyAction1.java.

1
2
3
4
5
6
7
8
9
10
<action name="myaction1" class="com.example.MyAction1">
  <result type="redirect-action">
    <param name="actionName">generateReport</param>
    <param name="sendCopyViaEmail">${sendCopyViaEmail}</param>
    <param name="empId">${empId}</param>
  </result>      
</action>
<action name="generateReport" class="com.example.GenerateReportAction">
  <result name="success">/WEB-INF/pages/report.jsp</result>
</action>
Categories: Java Tags:
Comments are closed.