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

当spring抛出异常时出现的页面的@ExceptionHandler(RuntimeException.class) 用法

时间:2018-06-16 23:35:13      阅读:438      评论:0      收藏:0      [点我收藏+]

标签:抛出异常   return   spring   redirect   control   exce   handler   页面   div   

当spring抛出异常时出现的页面的@ExceptionHandler(RuntimeException.class) 用法

主要用在Controller层

  @ExceptionHandler(RuntimeException.class) 
      public String ex() {
          //这个是当spring跑出异常时出现的页面
        return "redirect:/unauthorized.jsp";
      }

 

当spring抛出异常时出现的页面的@ExceptionHandler(RuntimeException.class) 用法

标签:抛出异常   return   spring   redirect   control   exce   handler   页面   div   

原文地址:https://www.cnblogs.com/charlypage/p/9191715.html

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