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.


<s:property value="name"/>

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


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

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

Then on jsp we can get these values as:

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