1.继承MethodFilterInterceptor
2.重写protected String doIntercept(ActionInvocation invocation)方法
3.配置拦截器
--注册自定义拦截器
<interceptor name="bosLoginInterceptor" class="com.itheima.bos.web.interceptor.BOSLoginInterceptor">
<!-- 指定不需要拦截的方法 -->
<param name="excludeMethods">login</param>
</interceptor>
--自定义拦截器栈
--自己写的拦截器
--默认的拦截器
--执行拦截器栈
<default-interceptor-ref name="myStack"></default-interceptor-ref>
--全局结果集配置
<global-results>
<result name="login">/login.jsp</result>
</global-results>
2.重写protected String doIntercept(ActionInvocation invocation)方法
3.配置拦截器
--注册自定义拦截器
<interceptor name="bosLoginInterceptor" class="com.itheima.bos.web.interceptor.BOSLoginInterceptor">
<!-- 指定不需要拦截的方法 -->
<param name="excludeMethods">login</param>
</interceptor>
--自定义拦截器栈
--自己写的拦截器
--默认的拦截器
--执行拦截器栈
<default-interceptor-ref name="myStack"></default-interceptor-ref>
--全局结果集配置
<global-results>
<result name="login">/login.jsp</result>
</global-results>