Load On Startup


Prev Tutorial Next Tutorial

<load-on-startup> Element in Servlet

This is a web.xml configuration elements used to configure a servlet to create servlet object during startup time of the server or application deploy on server. It is also known as pre initialization of servlet. This element need integer value to configure.

Advantage of load-on-startup element

As we know well, servlet is loaded at first request. That means it consumes more time at first request. If we specify the load-on-startup in web.xml, servlet will be loaded at project deployment time or server start. So, it will take less time for responding to first request.

Passing positive value

If we pass the positive value, the lower integer value servlet will be loaded before the higher integer value servlet. In other words, container loads the servlets in ascending integer value. The 0 value will be loaded first then 1, 2, 3 and so on.

Let's try to understand it by the example given below:



There are defined 2 servlets, both servlets will be loaded at the time of project deployment or server start. But, servlet1 will be loaded first then servlet2.

Passing negative value

If a negative value is configure then a container ignores this tag and waits for first request to create an object of a servlet but a container does not throws any exception.

Prev Tutorial Next Tutorial


Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Pure VPN Privide Lowest Price VPN Just @ $1.65. Per Month with Non Detected IP Lowest Price Non Detected IP VPN

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements

Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs