Let us build a simple web application using the Spring MVC concept:
- Open web.xml and register the main servlet handler of our Spring MVC application, which is org.springframework.web.servlet.DispatcherServlet.
<servlet> <servlet-name>ch02</servlet-name> <servlet-class> org.springframework.web.servlet.DispatcherServlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>ch02</servlet-name> <url-pattern>*.html</url-pattern> </servlet-mapping>
Be cautious with the <url-pattern> in web.xml because it is where DispatcherServlet picks the correct format for its request URLs. The pattern *.html means the main servlet will recognize all URL paths with a view extension of .html.
- In the ...