It is convenient to use servlet containers such as Tomcat. Configuring in Web. XML
<?XML version= "1.0" encoding= "UTF-8"?><Web-appXmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xmlns= "Http://java.sun.com/xml/ns/javaee"Xmlns:web= "Http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"xsi:schemalocation= "Http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"version= "2.5"> <Display-name>User Center</Display-name> <Error-page> <Error-code>404</Error-code> < Location>/resources/html/error404.html</ Location> </Error-page></Web-app>
Content of 404.html pages
<!DOCTYPE HTML><HTML><Head><MetaCharSet= "UTF-8"><title>404 error</title></Head><Body>the resource you are accessing does not exist</Body></HTML>
When accessing a URI that the system does not have, it automatically jumps from 404 pages
Of course, to configure this static resource is not blocked
SPRINGMVC's Custom 404 page