Let us assume two servlets defined in web.xml and have equal <load-on-startup> attribute. Which one of the servlet will be loaded in memory first at the time of server startup?

<servlet>
  <servlet-name>AuthenticationServlet</servlet-name>
  <display-name>AuthenticationServlet</display-name>
  <servlet-class>com.modernpathshala.AuthenticationServlet</servlet-class>         
  <load-on-startup>3</load-on-startup>
</servlet>

<servlet>
  <servlet-name>AuthorizationServlet</servlet-name>
  <display-name>AuthorizationServlet</display-name>
  <servlet-class>com.modernpathshala.AuthorizationServlet</servlet-class>
  <load-on-startup>3</load-on-startup>
</servlet>

Solution

If two servlets have same/equal load-on-startup value then they are loaded in the sequence defined in web.xml file.

Share this thread

Comments

Comments
comments powered by Disqus

Navigation

Social Media