`

在Action里往值栈中存放对象的方法

阅读更多

ActionContext.getContext().put("departmentList",departmentList);

是直接往 map栈中存放元素

Stack Context

Key                Value
departmentList      [cn.xiaoxian.domain.Department@8098]


<s:iterator value="departmentList"> 注意没用#


--------------------------------

ServletActionContext.getRequest().setAttribute("departmentList",departmentList);

放到request域中

所以要这样访问 <s:iterator value="#request.departmentList">

---------------------------------
ActionContext.getContext().getValueStack.push(departmentList);


<s:iterator> 因为没有对象名 可对象在栈顶 所以直接用<s:iterator>迭代栈顶的元素

---------------------------------
ActionContext.getContext().getValueStack.set("departmentList",departmentList);

做了一个HashMap "departmentList"做为key ,departmentList作为value

放到 对象栈中去了

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics