首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

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

2012-11-23 
在Action里往值栈中存放对象的方法ActionContext.getContext().put(departmentList,departmentList)是

在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

放到 对象栈中去了

?

热点排行
Bad Request.