一、获得值栈的方式:
1.ServletActionContext.getContext().getValueStack();
2.ActionContext.getContext().getValueStack();
二、值栈的使用
1. set键值对存入:
ServletActionContext.getContext().getValueStack().set("c", "cc");
取出:
<s:property value="c" /><br/>
2. push存入map栈顶:
ActionContext.getContext().getValueStack().pop();
ActionContext.getContext().getValueStack().push("bb");
取出:
<s:property value="[0].top" /><br/>
3. 设置getXxx()方法:
private String name;
public String getName(){
return name;
}
public String execute(){
name = "dd";
return "success";
}
取出:
<s:property value="name" />