Servlet load on startup

Servlet load on startup tag gets define inside web.xml deployment descriptor file. This tag is responsible to load a servlet as soon as server starts up running and call init() method at the same time.

Below is the sample webl.xml file having <load-on-startup> tag:

<servlet> tag contains <load-on-startup>, <servlet-name> and <servlet-class> tags.

We can define multiple <servlet> tags having unique values for <load-on-startup>, <servlet-name> and <servlet-class> tags.

<load-on-startup> tag can have positive, zero on negative value. 

The servlet with the lowest integer value will get loaded first. For example, suppose we have three <load-on-startup> tags in web.xml with values of -3, 0 and 2, respectively. As mentioned earlier, the servlet having the lowest value of -3 will load first. After that, it will load 0 and then 2.

Imran Khan

Specialist Master (Architect) with a passion for cutting-edge technologies like AEM (Adobe Experience Manager) and a proven track record of delivering high-quality software solutions.

  • Languages: Java, Python
  • Frameworks: J2EE, Spring, Struts 2.0, Hibernate
  • Web Technologies: React, HTML, CSS
  • Analytics: Adobe Analytics
  • Tools & Technologies: IntelliJ, JIRA

🌐 LinkedIn

📝 Blogs

📧 Imran Khan