In spring MVC-based application, you need to add the following configuration information in Web. XML:
<!--Spring MVC Servlet ---<servlet> <servlet-name>Servletname</servlet-name> <servlet-class> Org.springframework.web.servlet.DispatcherServlet </servlet-class> <load-on-startup>1</load-on-startup></servlet><servlet-mapping> <servlet-name>Servletname</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>
the special emphasis here is <url-pattern>/</url-pattern> is used/, instead of/*, if/ * is used, Then the request can be forwarded to the appropriate action or controller through Dispatcherservlet, but the returned content, such as the returned JSP will also be intercepted again, resulting in a 404 error, that is, access to the JSP. So if you find that there are always 404 errors, don't forget to check if <url-pattern>/</url-pattern> 's configuration is/*.
The difference between blocking/and intercepting/* in spring