According to reason, this should be very simple, Baidu has a bunch, but every method is useless, and most of the text is crawler.
My method is as follows
1. Add under web.xml
。。。。。
<error-page>
<error-code>404</error-code>
<location>/html/404.html</location>
</error-page>
</web-app>
2. The xml configuration file of spring mvc under WEB-INF/
<mvc:resources location="/html/" mapping="/html/**"/>
3. Under webapp or webContent, add html to customize the 404 page
4. Principle
Visit a url that does not exist, there will be a 404 error, and then
(1) The program looks for the 404 configuration in the web.xml file, and the corresponding path is /html/404.html
(2) "/html/404.html" found the configuration of <mvc:resources in applicationContent.xml, and found that the URL conforms to the mapping.
(3) Take out the location of the second step, namely /html/, which is webContent/html/404.html