http://blog.csdn.net/z69183787/article/details/16342553

struts2的@Result annotation 如何添加params,并且在页面取值

1、action跳转至jsp

后台:(需有get set 方法)

  1. @SuppressWarnings("rawtypes")
  2. @Action(value="/loadFileList",results={
  3. @Result(name="attachList",location="/attach/attachList.jsp",params={"attachMemo1","${attachMemo1}"}),
  4. @Result(name="attachList1",location="/attach/attachList1.jsp"),
  5. @Result(name="attachListHT",location="/attach/attachListHT.jsp")})

前台:

  1. <%out.println(request.getAttribute("attachMemo1")); %>

2、action跳转至action

后台:(stptuser为 action中的bo)

  1. @Action(value="stptUserUpdate",results={
  2. @Result(name="stptUserEdited",params={"actionName","stptUserView","stptUserId","%{stptUser.id}"},type="redirectAction")
  3. })

或者

  1. @Result(name="success",
  2. type="redirectAction",
  3. location="d-list",
  4. params={"id", "%{id}"}
  5. )

另一个action获取

    1. @Action(value="stptUserView",results={
    2. @Result(name="success",location="/userManage/stptUserView.jsp")
    3. })
    4. public String stptUserView(){
    5. String id = StringUtil.getNotNullValueString(super.getServletRequest().getParameter("stptUserId"));
    6. this.stptUser = this.stptUserService.findStptUserById(Long.parseLong(id));
    7. List<ManagerVo> list = this.stptUserService.getUserInfo(id);
    8. List<ManagerVo> agentList = this.stptUserService.getAgentInfo(id);
    9. super.getServletRequest().setAttribute("voList", list);
    10. super.getServletRequest().setAttribute("agentList", agentList);
    11. return SUCCESS;
    12. }

最新文章

  1. FileSystem.DeleteDirectory遇到&quot;无法删除 文件:无法读取源文件或磁盘&quot;
  2. EasyUI需注意的问题01
  3. window.location.href 失效的解决办法
  4. 2016.1.4~2016.1.7真题回顾!-- HTML5学堂
  5. 从0开始学Swift笔记整理(五)
  6. 获得供应商最近一次报价:OVER(PARTITION BY)函数用法的实际用法
  7. TCP协议RST:RST介绍、什么时候发送RST包
  8. hdu 3535 AreYouBusy
  9. josscrowcroft / Simple-JavaScript-DOM-Inspector
  10. FusionCharts中图的属性的总结归纳
  11. 看懂 ,学会 .NET 事件的正确姿势-简单版
  12. Spring Boot 2.x 编写 RESTful API (六) 事务
  13. -bash: fork: Cannot allocate memory 问题的处理
  14. [ 随手记 2 ] C/C++ 数组/指针/传数组到函数/指针数组/数组指针
  15. 章节二、4-String以及StringBuffer和StringBuilder的对比
  16. 关于js的函数
  17. 【推荐】使用Ultrapico Expresso学习正则表达式
  18. Java的反射机制Reflect
  19. C51 头文件中的 extern
  20. Android AppCompat 需要 API 级别 11

热门文章

  1. 基于BASYS2的VHDL程序——交通灯(状态机版)
  2. 编译Thrift
  3. Vue表格数据增删改查及搜索
  4. NLP任务中的基本指标(precision and recall )
  5. python 基础之第九天
  6. 「USACO16OPEN」「LuoguP3147」262144(区间dp
  7. MTK UART串口调试
  8. 使用libvirt技术监控虚拟机资源利用情况
  9. SpringMVC配置字符过滤器的两种方式
  10. ** Error in `./g2o_viewer&#39;: realloc(): invalid pointer: