集成spring框架的web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app  version="2.5"
        xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
        http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
  <display-name>Archetype Created Web Application</display-name>
  
    <!-- 加载Spring配置文件 -->
         <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:/configs/spring-servlet.xml</param-value>
         </context-param>
         <!-- Spring监听 -->
         <listener>
             <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
         </listener>
         <!-- Spring MVC配置 -->
         <servlet>
              <servlet-name>Dispatcher</servlet-name>
              <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
              <!-- 自定义spring mvc的配置文件名称和路径 -->
              <init-param>
                  <param-name>contextConfigLocation</param-name>
                  <param-value>classpath*:spring-servlet.xml</param-value>
              </init-param>
              <load-on-startup>1</load-on-startup>
         </servlet>
         <!-- spring mvc 请求后缀 -->
         <servlet-mapping>
            <servlet-name>Dispatcher</servlet-name>
            <url-pattern>/</url-pattern>
         </servlet-mapping>
         <welcome-file-list>
            <welcome-file>index.jsp</welcome-file>
         </welcome-file-list>
</web-app>

 

posted @ 2017-10-17 09:03  _一直在努力  阅读(93)  评论(0编辑  收藏  举报