Hi,
We've been trying to redirect from one action to another, hoping that data would pass itself from ActionForm to ActionForm. Basically, we have to actions. The first action receives a request from the browser, prints some data field, and forwards it to another action, that prints the same fiend and redirects to a jsp. The thing is that the second print is printing an incorrect value (its not null because its an int, but it's a dissapointing 0, and it should be 35)
Here is a representing example
public class ActionFrom extends DispatchableAction{
public ActionForward send(ActionMapping mapping, ActionForm form, HttpServletRequest request,HttpServletResponse response){
FormA formA = (FormA)form;
formA.commonInt = 35;
System.out.println("sent: "+formA.commonInt);
return mapping.findForward("send");
}
}
public class ActionTo extends DispatchableAction{
public ActionForward recv(ActionMapping mapping, ActionForm form, HttpServletRequest request,HttpServletResponse response){
FormB formB = (FormB)form;
System.out.println("recv= "+formB.commonInt);
return mapping.findForward("send");
}
}
And actionForms are:
public class FormA extends ActionForm {
public int intA;
public int commonInt;
}
public class FormB extends ActionForm{
public int intB;
public int commonInt;
}
Mappings:
<action path="/from" type="EXPERIMENT.ActionFrom" name="formA" scope="request"
input="something.jsp" parameter="dispatch" unknown="false" validate="false">
<forward name="send" path="/to.do?dispatch=recv" redirect="false"/>
</action>
<action path="/to" type="EXPERIMENT.ActionTo" name="formB" scope="request"
input="something.jsp" parameter="dispatch" unknown="false" validate="false">
<forward name="send" path="/login.do" redirect="false"/>
</action>
We expected the System.out.println("recv= "+formB.commonInt); to print out 35, but it printed out 0. Is there a way to accomplish this? Or both forms should be the same?
The workaround we tried was to pass things through request, but it can get large and messy.