① Map session = ServletActionContext.getContext().getSession();
② ActionContext.getContext().getSession();
③ WebContext ctx = WebContextFactory.get();
HttpSession session = ctx.getSession();
① 获取的session是原生的session,可以调用setAttribute()方法
② 获取的session是struts封装过的一个Map类型的session,只能调用put()方法缓存数据。
②和③前一个是将值保存到session中,效果等同于session.setAttribute("",""),
前者就是struts2对后者的一个封装,把session,request,application全都放到了actioncontext()容器中了。