Listener, filter, servlet load order in Web. xml

Source: Internet
Author: User

The order of loading is independent of their sequencing in the Web. xml file. That is, the filter is not loaded before the filter is written in front of the listener.

The true load order is: servlet, Context-param, listener, filter

< Span style= "margin:0px; padding:0px; Color:rgb (51,51,51); Font-family:verdana,arial,helvetica,sans-serif; Line-height:20.909090042114258px ">

        However, for a class of configuration sections, it is related to the order in which they appear. In the case of filter, it is possible to define multiple filter in Web. XML, a configuration section related to filter is filter-mapping, and it is important to note that for filter and filter-mappin with the same filter-name In the case of the G configuration section, the filter-mapping must appear after the filter, or the corresponding filter-name is undefined when parsing to filter-mapping. When each filter is initialized when the Web container starts, it is initialized in the order in which the Filter configuration section appears, and when the request resource matches multiple filter-mapping, the filter interception resources are called dofilter () method.

< Span style= "margin:0px; padding:0px; Color:rgb (51,51,51); Font-family:verdana,arial,helvetica,sans-serif; Line-height:20.909090042114258px ">

< Span style= "margin:0px; padding:0px; Color:rgb (51,51,51); Font-family:verdana,arial,helvetica,sans-serif; Line-height:20.909090042114258px "> If you want to load spring beans in listner, be aware that Spring's related Listner in Web. XML must precede the custom Listner to load spring's listner



<listener><listener-class>org.springframework.web.util.introspectorcleanuplistener</ Listener-class></listener><listener><listener-class> Org.springframework.web.context.contextloaderlistener</listener-class></listener>


  <listener><listener-class>com.wizincloud.wxmanager.tokenmanager.messagehandlelistener</ Listener-class></listener>



Listener, filter, servlet load order in Web. xml

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.