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

  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;      

 

评论
发表评论

您还没有登录,请登录后发表评论