Spring mvc:配置不攔截指定的路徑


    <!-- 訪問攔截  -->  
      <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.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM