***************1.[一般推荐使用](只能获得request,而response则得不到)**********************
ActionContext.getContext().put("liuwei", "andy"); //request.setAttribute("liuwei", "andy");
Map map=ActionContext.getContext().getSession(); //session
map.put("username", "name");
*************2.[强烈推荐使用]***********
HttpServletRequest request = ServletActionContext.getRequest();
HttpServletResponse response = ServletActionContext.getResponse();
request.getSession().setAttribute("username","liuwei");
request.setAttribute("pass", "132");
*************3[一般不推荐](麻烦,与servlet API 耦合大).*****************
继承 implements ServletRequestAware
类中申明:private HttpServletRequest request;
实现接口的方法:
public void setServletRequest(HttpServletRequest request)
{
this.request = request;
}