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