Posted On: Feb 22, 2018
In general, on the very first request of the client, the server container loads a servlet. But in case, the servlet is too heavy that it takes much time to load, at that time we might want it to load during the application startup. To do this, the user can use WebServlet notation or loadOnStartup variable to stimuli container. Or, we can use a load-on-startup element with a servlet configuration in web.xml file to load the servlet on startup.
Syntax:
<servlet> <servlet-name>coo </servlet-name> <servlet-class>com.coo.servlets.Coo </servlet-class> <load-on-startup>6 </load-on-startup> </servlet>
If you want that the container loads the servlet on client request, then the load-on-startup value should be negative otherwise if it’s positive then the loading will start on application startup.
If there are many servlets with different load-on-startup values, then that servlet will be loaded first which have the lowest value.
Never Miss an Articles from us.
It is designed by the Java software company. It is used to extend the ability of the server...
Web Server is the connection between the HTTP and HTML...
If any HTTP brings the same result every time then it means it is idempotent...