zoukankan      html  css  js  c++  java
  • @Results( 中 params 怎么用

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

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

    1、action跳转至jsp

    后台:(需有get set 方法)

    [java] view plain copy
     
    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")})  


    前台:

    [html] view plain copy
     
    1. <%out.println(request.getAttribute("attachMemo1")); %>  


    2、action跳转至action

    后台:(stptuser为 action中的bo)

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


    或者

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


    另一个action获取

    [java] view plain copy
     
      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.     }  
  • 相关阅读:
    Java线程池使用说明
    Java并发编程:Thread类的使用
    深入理解Java的接口和抽象类
    编程中经常看到上下文context,这个上下文指得是什么?
    context
    setContentView和inflate区别
    Java for循环的几种用法分析
    Android学习06Android应用程序的基本组件
    learning java 重定向标准输入输出
    learning java 推回输入流
  • 原文地址:https://www.cnblogs.com/ConfidentLiu/p/8434662.html
Copyright © 2011-2022 走看看