web.xml: load-on-startup for servlets
February 11, 2010 00:04:02
Servlet container initializes this servlet when it starts up. The content of this element must be a positive integer indicating the order in which the servlet should be loaded. Lower integers are loaded before higher integers.
If no value is specified, or if the value specified is not a positive integer, the servlet can be loaded in any order in the startup sequence.
In this example, Struts is loaded before cms:
If no value is specified, or if the value specified is not a positive integer, the servlet can be loaded in any order in the startup sequence.
In this example, Struts is loaded before cms:
<!-- Struts action servlet setup --> <servlet> <servlet-name>action</servlet-name> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> <init-param> <param-name>config</param-name> <param-value>/WEB-INF/struts-config.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <!-- All .do requests go to struts --> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> <servlet> <servlet-name>cms</servlet-name> <servlet-class>com.example.ContentManagementSystem</servlet-class> <load-on-startup>2</load-on-startup> </servlet> <servlet-mapping> <!-- *.cms pages are handled by the cms servlet --> <servlet-name>cms</servlet-name> <url-pattern>*.cms</url-pattern> </servlet-mapping>
Easy email testing with http://www.ximailstop.com