I have a question regarding the struts2 value stack. Let's say I have an Action class called RegisterAction that has an execute method as follows:
public String execute() {
ValueStack stack = ActionContext.getContext().getValueStack();
stack.push(new String("test string"));
return SUCCESS;
}
My struts.xml looks like this:
<struts>
<package name="default" extends="struts-default">
<action name="*Register" method="{1}" class="vaannila.RegisterAction">
<result name="populate">/register.jsp</result>
<result name="input">/register.jsp</result>
<result name="success">/success.jsp</result>
</action>
<action name="*Test" method="{1}" class="vaannila.TestAction">
<result name="test">/test.jsp</result>
<result name="success">/success2.jsp</result>
</action>
</package>
</struts>
So control will flow to the success.jsp after the execute method executes in that class.
My questions are:
1) how do I get that value I pushed on the stack in the success.jsp?
2) Let's say in success.jsp I have a <s:submit method="testMethod" />
that redirects to an action class called TestAction. In other words, from the Register page, the user clicks submit, and in the execute method of the RegisterAction we push the "test string" on the stack. Then we go to success.jsp. The success.jsp has a submit button that directs us to TestAction#testMethod. In TestAction#testMethod, is the value I pushed on the stack in RegisterAction#execute still there? How can I get it? I stepped through the eclipse debugger but I don't see the value.
Thanks.