拦截器的执行顺序和在action中的使用顺序是一样的,在执行完action后反向的顺序的执行该action有的拦截器,然后返回String(input,success,login,error,none)
1.自定义的拦截器要继承自AbstractInterceptor
2.要在struts.xml文件中声明拦截器,如果一个action不使用自己的拦截器,
那么会使用struts默认的拦截器栈(defaultStack),如果使用了自定义的拦截器就不会自动使用默认的拦截器
3.在struts.xml文件中所有extends="struts-default"的包都继承自默认的包
4.要在package标签里注册拦截器:
<interceptors>
<interceptor name=" " class=" "></interceptor>
<interceptor-stack name=" ">
<interceptor-ref name="defaultStack"></interceptor-ref>
<interceptor-ref name=" "></interceptor-ref>
</interceptor-stack>
</interceptors>
5.在action标签中使用拦截器:
<interceptor-ref name=""></interceptor-ref>
放在WEB-INF中的jsp页面不能被直接访问,要通过action跳转才能访问