ServletContextListener在Tomcat中的配置問題

在帶有監聽器的servlet中,執行的順序是這樣的,首先創建servletListerner,而後運行,初始化ServletContext,而後監聽ServletContext的變化,最後ServletContext被銷燬,加ServletListener的時候不用添加其餘的什麼配置只在web.xml裏面加上監聽器就能夠了,web

servlet能夠設置優先級的 
能夠把serlet的啓動優先級設高一點 
<load-on-startup> 1 </load-on-startup>app

 

<servlet> 
          <servlet-name> proxoolServletConfigurator </servlet-name> 
          <servlet-class> org.logicalcobwebs.proxool.configuration.ServletConfigurator </servlet-class> 
          <init-param> 
              <param-name> xmlFile </param-name> 
              <param-value> WEB-INF/proxool.xml </param-value> 
          </init-param> 
          <load-on-startup> 1 </load-on-startup> 
      </servlet> 
      <servlet> 
        <servlet-name> proxoolAdmin </servlet-name> 
        <servlet-class> org.logicalcobwebs.proxool.admin.servlet.AdminServlet </servlet-class> 
      </servlet> 
      <servlet-mapping> 
        <servlet-name> proxoolAdmin </servlet-name> 
        <url-pattern> /proxooladmin </url-pattern> 
      </servlet-mapping> 
      
      <listener> 
          <listener-class> com.mission.init.SysContextListener </listener-class> 
      </listener>
 url

相關文章
相關標籤/搜索