码迷,mamicode.com
首页 > 编程语言 > 详细

SpringBoot中自定义错误页面

时间:2019-07-04 20:15:03      阅读:308      评论:0      收藏:0      [点我收藏+]

标签:mes   errors   message   错误提示   status   cep   引擎   自动   col   

 

错误页面定制(在有模板引擎的情况下):

有模板的支持下: 在templates文件夹下 建立 error文件夹
error文件夹下
404.html
500.html

4xx.html (名字就叫4xx.html)
5xx.html 

就像这样:

技术图片

 

 

错误消息的定制:

  timestamp:时间戳

?    status:状态码

?    error:错误提示

?    exception:异常对象

?    message:异常消息

?   errors:JSR303数据校验的错误都在这里

  通过[[${status}]]获取这样获取!

 比如这样:

技术图片

 



SpringBoot如果出现上面的问题 会自动转到该页面!!

 

测试效果:

技术图片

技术图片

 

SpringBoot中自定义错误页面

标签:mes   errors   message   错误提示   status   cep   引擎   自动   col   

原文地址:https://www.cnblogs.com/gu-bin/p/11134593.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!