Question - How is the dispatcher servlet instantiated?
Answer -
The dispatcher servlet is instantiated by means of servlet containers such as Tomcat. The Dispatcher Servlet should be defined in web.xml The DispatcherServlet is instantiated by Servlet containers like Tomcat. The Dispatcher Servlet can be defined in web.xml as shown below:
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
appServlet
org.springframework.web.servlet.DispatcherServlet
/WEB-INF/spring/appServlet/servlet-context.xml
1
InterviewBitServlet
/
Here, the load-on-startup tag is 1 which indicates that the DispatcherServlet is instantiated whenever the Spring MVC application to the servlet container. During this process, it looks for the servlet-name-context.xml file and initializes beans that are defined in the file.
Comment(S)
Show all Coment
Leave a Comment