Struts 2 ValueStack

Valuestack: A stack which contains the action property,model objects,named objects etc.

On Jsp value from stack can be accessed using tag like property.

Example:

<s:property value="name"/>

Form values are automatically get stored on stack and we also have option to add any specific object to valuestack.

Example:

ValueStack stack = ActionContext.getContext().getValueStack();
Map mapObj = new HashMap();

      context.put("name", "Ankit"); 
      context.put("place", "INDIA");
      stack.push(context);

Then on jsp we can get these values as:

<s:property value="name"/>
<s:property value="place"/>