June 2018
Intermediate to advanced
408 pages
11h 23m
English
To configure the front controller servlet, DispatcherServlet, in an XML-based configuration, we need to add the following XML code in the web.xml file:
<servlet> <servlet-name>spring-mvc</servlet-name> <servlet-class> org.springframework.web.servlet.DispatcherServlet </servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring-mvc-context.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring-mvc</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>
In the preceding XML code, at first, we configured the DispatcherServlet. Then, we mentioned the context configuration location, /WEB-INF/spring-mvc-context.xml ...
Read now
Unlock full access