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

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;   

你可能感兴趣的:(struts,action)