| Author |
Newbie Question
|
Sandeep Awasthi
Ranch Hand
Joined: Oct 23, 2003
Posts: 597
|
|
Hi All, I am new to struts and I have come accross a problem. I have one action class which extends DispatchAction and it used to display list of Emps or Depts depending on actionType parameter. Now I have one more class DispatchAction Class which I use to either edit or add new Emp depending on value of actionType parameter. After adding an employee, I want to forward it to ShowList action. <global-forwards> <!-- Default forward to "Welcome" action --> <!-- Demonstrates using index.jsp to forward --> <forward name="welcome" path="/Welcome.do"/> <forward name="ShowList" path="/ShowList.do"/> </global-forwards> <action path="/ShowList" type="com.test.action.ShowListAction" parameter="actionType"> <forward name="ShowEmpList" path="/pages/EmpList.jsp"/> <forward name="ShowDeptList" path="/pages/DeptList.jsp"/> </action> <action path="/EmpEdit" type="com.test.action.EditEmpAction" parameter="actionType" input="/pages/EmpDet.jsp" name="EmpBean" scope="session"> <forward name="success" path="/ShowList"/> </action> Obviously this will not work because after adding emp, actionType parameter will have value either addEmp or editEmp and showList action expects showEmpList or showDeptList. Is there a way to set parameter actionType to some value(e.g. showEmpList in this case) in Action class,before I forward action to ShowList Thanks alot in advance
|
Sandeep
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
Try this in your action: forward = mapping.findForward("ShowList"); forward.setPath(forward.getPath()+"?actionType=showEmpList");
|
Merrill
Consultant, Sima Solutions
|
 |
 |
|
|
subject: Newbie Question
|
|
|