struts2的@Result annotation 如何添加params,并且在页面取值
http://www.bubuko.com/infodetail-2492575.html
、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
标签:lai util date cati rec turn nds csdn bsp
http://blog.csdn.net/z69183787/article/details/16342553
struts2的@Result annotation 如何添加params,并且在页面取值
1、action跳转至jsp
后台:(需有get set 方法)
- @SuppressWarnings("rawtypes")
- @Action(value="/loadFileList",results={
- @Result(name="attachList",location="/attach/attachList.jsp",params={"attachMemo1","${attachMemo1}"}),
- @Result(name="attachList1",location="/attach/attachList1.jsp"),
- @Result(name="attachListHT",location="/attach/attachListHT.jsp")})
前台:
- <%out.println(request.getAttribute("attachMemo1")); %>
2、action跳转至action
后台:(stptuser为 action中的bo)
- @Action(value="stptUserUpdate",results={
- @Result(name="stptUserEdited",params={"actionName","stptUserView","stptUserId","%{stptUser.id}"},type="redirectAction")
- })
或者
- @Result(name="success",
- type="redirectAction",
- location="d-list",
- params={"id", "%{id}"}
- )
另一个action获取
- @Action(value="stptUserView",results={
- @Result(name="success",location="/userManage/stptUserView.jsp")
- })
- public String stptUserView(){
- String id = StringUtil.getNotNullValueString(super.getServletRequest().getParameter("stptUserId"));
- this.stptUser = this.stptUserService.findStptUserById(Long.parseLong(id));
- List<ManagerVo> list = this.stptUserService.getUserInfo(id);
- List<ManagerVo> agentList = this.stptUserService.getAgentInfo(id);
- super.getServletRequest().setAttribute("voList", list);
- super.getServletRequest().setAttribute("agentList", agentList);
- return SUCCESS;
- }
标签:lai util date cati rec turn nds csdn bsp
原文:https://www.cnblogs.com/ConfidentLiu/p/8434662.html