dispatcherServlet-servlet.xml(SSM maven 項目)


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">

    <!--SpringMVC的配置文件,包含網站跳轉邏輯的控制 、 配置    默認規則  use-default-filters=" false"  -->
    <context:component-scan base-package="xyz.sun" use-default-filters="false">
        <!--只掃描控制器   所有標有Controller  注解的都是控制器-->
        <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"></context:include-filter>
    </context:component-scan>


    <!--配置視圖解析器,方便頁面返回-->
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/views"></property>
        <property name="suffix" value=".jsp"></property>
    </bean>

    <!--兩個標准配置-->
    <!--將springmvc不能處理的請求交給tomcat-->
    <mvc:default-servlet-handler />
    <!-- 能支持springmvc 更高級的一些功能 JSR303校驗 快捷Ajax請求  映射動態請求  -->
    <mvc:annotation-driven />



</beans>

 


免責聲明!

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



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