如果我没记错的话,非加载顺序,应该是WEB服务器启动后经过的时间(时间单位是MS?)后将servlet实例化,没有该选项则在有请求时再实例化.

解决方案 »

  1.   

    搬来一段Servlet specification应该够说服力的了吧。
       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.   

    除了那段 E 文没有好好看(E 文还没学好),其他的都没说到点子上。大多数 Servlet 是在用户第一次请求的时候由应用服务器创建并初始化,但 <load-on-startup>n</load-on-startup> 可以用来改变这种状况,该元素说明某个 Servlet 在应用程序启动的时候就立即装入 Servlet,并初始化它。这是一个非常有用的特点,如果楼主想不出这样做有什么用,就当它不存在好了。:)