自定义Interceptor后获得Session对象
自定义拦截器的时候 主要分为 三步
1.定义拦截器类 重要的是要继承 AbstractInterceptro 类 重写里面的 intercept(ActionInvocation actionInvocation) 方法
另外注意 其中得到session 对象的方法
ActionContext ac = actionInvocation.getInvocationContext();
Map<String,Object> session = ac .getSession();
2.在struts2 的配置文件中 struts2.xml 文件中声明配置 intercepor
<!--当拦截器 将请求拦截后 处理失败 将会跳转到指定的页面
不再继续执行Action 这是要定义一个全局的 results-->
/login.jsp
LoginInterceptor
/showUser.jsp