web.xml的加载过程是context-param >> listener >> fileter >> servlet

Eclipse  Web项目下的Web.xml文件下的标签加载过程是context-param >> listener >> fileter >> servlet

<?xml version="1.0" encoding="UTF-8"?>
<web-app 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_3_0.xsd"
    version="3.0">
    <welcome-file-list>
        <welcome-file>test.jsp</welcome-file>
    </welcome-file-list>
    <!-- Spring IOC配置 -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:spring/applicationContext.xml</param-value>
    </context-param>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <filter>
    <filter-name>myFilter</filter-name>
    <filter-class>xx.MyFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>myFilter</filter-name>
<servlet-name>目标资源一</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>myFilter</filter-name>
<servlet-name>目标资源二</servlet-name>
</filter-mapping> <!-- SpringMVC --> <servlet> <servlet-name>dispatcherServlet</servlet-name> <servlet-class> org.springframework.web.servlet.DispatcherServlet </servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring/spring-mvc.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>dispatcherServlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> </web-app>

 

posted @ 2019-04-19 15:52  木&子  阅读(219)  评论(0编辑  收藏  举报