获得request对象的方法

1

    public void Test(HttpServletRequest request,HttpServletResponse response){

}


com.opensymphony.xwork2.ActionContext
javax.servlet.http.HttpServletRequest
org.apache.struts2.ServletActionContext


2 ActionContext ctx = ActionContext.getContext();
HttpServletRequest request = (HttpServletRequest)ctx.get(ServletActionContext.HTTP_REQUEST);



3 struts2 获取

ServletActionContext.getResponse().setCharacterEncoding("UTF-8");

org.apache.struts2.ServletActionContext 这个包下面的

ServletActionContext.getRequest();

ServletActionContext.getResponse();

你可能感兴趣的:(获得request对象的方法)