Go to the WEB-INF> Views folder.
Create a page, for example: error_404.jsp.
Now you need to create a controller.
@RequestMapping(value="/error", method = RequestMethod.GET) public String error_404(){ return "error_404"; }
Now edit the web.xml file and edit it as follows:
<error-page> <error-code>404</error-code> <location>/error</location> </error-page>
source share