Required Configuration
You need to map requests that you want the DispatcherServlet to handle, by using a URL mapping in the web.xml file. The following is an example to show declaration and mapping |
for HelloWebDispatcherServlet example: |
<web-app id="WebApp_ID" version="2.4" <display-name>Spring MVC Application</display-name> <servlet> org.springframework.web.servlet.DispatcherServlet </servlet-class> <load-on-startup>1</load-on-startup> <servlet-mapping> </servlet-mapping> |
The web.xml file will be kept WebContent/WEB-INF directory of your web application. OK, upon initialization of HelloWeb DispatcherServlet, the framework will try to load the application context from a file named [servlet-name]-servlet.xml located in the application's WebContent/WEB- INF directory. In this case our file will be HelloWeb-servlet.xml. |