<servlet>   
          <servlet-name>servlet</servlet-name>   
          <servlet-class>***.XXServlet</servlet-class>   
          <load-on-startup>2</load-on-startup>   
  </servlet>
谁能解释解释那个2是什么意思?  
我是新手,好心的过来帮帮忙!!! 

解决方案 »

  1.   

    The load-on-startup element indicates that this servlet should be loaded (instantiated and have its init() called) on the startup of the web application. The optional contents of these element must be an integer indicating the order in which the servlet should be loaded. If the value is a negative integer, or the element is not present, the container is free to load the servlet whenever it chooses.  If the value is a positive integer or 0, the container must load and initialize the servlet as the application is deployed. The container must guarantee that servlets ed with lower integers are loaded before servlets ed with higher integers. The container may choose the order of loading of servlets with the same load-on-start-up value.
      

  2.   

    load-on-startup元素的存在表明在web应用在启动是应该加载该Servlet的。这个元素的可选内容一定要是整数,这个整数用来表明Servlet被加载的顺序。如果这个整数的值为负数,或者该元素不存在,这时容器可以在它需要该Servlet时才加载。如果这个整数的值为正数或者0,这时容器会在应用程序启动时加载并初始化该Servlet。容器会按照该元素的值的大小从小到大依次加载Servlet。当该元素的值相同时,有容器来决定servlets的加载顺序。