Struts2网页面传值两种方式

第一种方式:

/** 列表 */
public String list() throws Exception {
List<Role> roleList = roleService.findAll();
ActionContext.getContext().put("roleList", roleList);
return "list";
}

 

第二种方式:

/** 修改页面 */

private Role model = new Role();
public String editUI() throws Exception {
// 准备回显的数据
Role role = roleService.getById(model.getId());
ActionContext.getContext().getValueStack().push(role);

return "saveUI";
}

posted @ 2016-09-01 22:10  江山一族  阅读(206)  评论(0编辑  收藏  举报