struts2 - struts 2 Action chain getting different values of same object -
i have action class passing value jsp, modifying value in action class 1 , due action chain, action2 being called. in action 2 getting original value
value= 100// in jsp action 1: value*10= 1000// action 1 go action 2
i want modified value go action 2 i.e. 1000//
value modified in action 1. getting10// i.e. original value.
can tell me in order use values obtained action 1.
struts.xml
<action name="action1" class="vaannila.action.action1"> <result name="success" type="chain">action2 </result> </action> <action name="action2" class="vaannila.action.action2"> <result name="success" type="dispatcher">result.jsp </result> </action>
action 1
public class action1 extends actionsupport implements sessionaware{ public string execute() throws exception{ system.out.println("original"+ psb.getvalue() ); // getting 10 psb.getvalue((psb.getvalue()*10)); system.out.println("modified"+ psb.getvalue() ); // getting 100 return "success"; } }
action 2:
public class action2 extends actionsupport implements sessionaware{ public string execute() throws exception{ system.out.println("original"+ psb.getvalue() ); // getting 10 instead of 100. return "success"; } }
change action 1 follows
public class action1 extends actionsupport implements sessionaware{ public string execute() throws exception{ system.out.println("original"+ psb.getvalue() ); // getting 10 psb.setvalue((psb.getvalue()*10)); system.out.println("modified"+ psb.getvalue() ); // getting 100 return "success"; }
the mistake have calculated value in action1 class did not updated session
Comments
Post a Comment