To enable this, we would need to add DispatcherServlet to web.xml. Let's look at how to do that:
<servlet> <servlet-name>spring-mvc-dispatcher-servlet</servlet-name> <servlet-class> org.springframework.web.servlet.DispatcherServlet </servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/user-web-context.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring-mvc-dispatcher-servlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>
The first part is to define a servlet. We are also defining a context configuration location, /WEB-INF/user-web-context.xml. We will define a Spring ...