Spring MVC: How to return custom 404 errorpages?

后端 未结 8 2156
遇见更好的自我
遇见更好的自我 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:10

    modified your web.xml file.Using following code.

    App Name 
    
    500
    /error500.jsp
    
    
    
    404
    /error404.jsp
    
    

    Access this by following code.

    response.sendError(508802,"Error Message");
    

    Now add this code in web.xml.

    
    508802
    /error500.jsp
    
    

提交回复
热议问题