java中<load-on-startup>
java中含义 java中的load-on-startup用于表示该servlet是否在servlet容器启动的时候加载。示例:load-on-startup>xxload-on-startup>其中:如果xx是负数或者其他数值或者没有指定,表示该servlet在被选择时才加载; 如果xx为正数或者为0,表示在servlet容器启动的时候就加载,而且数值越小,加载的
<servlet>
<servlet-class>类名</servlet-class>
<servlet-name>sss</servlet-name>
<load-on-startup>2</load-on-startup>
</servlet>
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 marked with lower integers are loaded before servlets marked with higher integers. The container may choose the order of loading of servlets with the same load-on-start-up value.
example:
<servlet>
<servlet-name>initservlet</servlet-name>
<servlet-class>com.bb.eoa.util.initServlet</servlet-class>
<init-param>
<param-name>log4j-init-file</param-name>
<param-value>config/log.properties</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
更多推荐
所有评论(0)