<!-- 訪問攔截 -->
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/**/**"/>
<!-- 不攔截的url -->
<mvc:exclude-mapping path="/hello.html"/> // 這里只能指定靜態的文件 不能指定class,這里不能配置WEB-INFO下的jsp等靜態文件,因為WEB-INFO下的靜態文件是不能溝通瀏覽器url直接訪問的.
<bean class="com.cd.interceptor.LoginHandlerInterceptor"/>
</mvc:interceptor>
</mvc:interceptors>
因為mvc:exclude-mapping不被http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd 支持
所以要改成http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
即可.
不然會報錯:
cvc-complex-type.2.4.a: Invalid content was found starting with element 'mvc:exclude-mapping'. One
of '{"http://www.springframework.org/schema/mvc":mapping, "http://www.springframework.org/
schema/beans":bean}' is expected.