struts2 Action中获取request, response对象的方法

来源:互联网 发布:和君咨询怎么样知乎 编辑:程序博客网 时间:2024/05/21 08:57
  1. ActionContext ctx = ActionContext.getContext();       
  2.       
  3.   HttpServletRequest request = (HttpServletRequest)ctx.get(ServletActionContext.HTTP_REQUEST);       
  4.       
  5.   HttpServletResponse response = (HttpServletResponse)ctx.get(ServletActionContext.HTTP_RESPONSE);       
  6.         
  7.   //ServletActionContext.APPLICATION;       
  8.   //ServletActionContext.SESSION;       
  9.   //ServletActionContext.PAGE_CONTEXT;   
原创粉丝点击