Spring MVC: How to return custom 404 errorpages?

后端 未结 8 2124
遇见更好的自我
遇见更好的自我 2020-11-27 04:40

I\'m looking for a clean way to return customized 404 errorpages in Spring 4 when a requested resource was not found. Queries to different domain types should result in diff

8条回答
  •  孤城傲影
    2020-11-27 05:04

    We can just add following lines of code into web.xml file and introduce a new jsp file named errorPage.jsp into root directory of the project to get the requirement done.

    
        400
        /errorPage.jsp
    
    
        404
        /errorPage.jsp
    
    
        500
        /errorPage.jsp
    
    

提交回复
热议问题