天天看點

springMVC攔截器問題

寫了一個登入頁面,配置了攔截器,但是隻放行了login,對于static資源沒有放行,是以頁面的樣式不會顯示。是以登入時用到的方法和樣式都需要放行。

<!-- 配置攔截器 -->
    <mvc:interceptors>
        <mvc:interceptor>
            <mvc:mapping path="/**"/>
            <!-- 配置攔截器不攔截路徑,可使用通配符 -->
            <mvc:exclude-mapping path="/login"/>
            //資源放行
            <mvc:exclude-mapping path="/static/**"/>
            //登入的方法進行放行,不然隻顯示登入頁面,不會進行登入驗證
            <mvc:exclude-mapping path="/validateUser"/>
            <bean class="com.notice.interceptor.LoginInterceptor"/>
        </mvc:interceptor>
    </mvc:interceptors>