首页 > 编程语言 > 详细

SpringMVC 异常处理

时间:2016-09-01 10:55:45      阅读:159      评论:0      收藏:0      [点我收藏+]

方式一

@ExceptionHandler(RuntimeException.class)
    public String runtimeExceptionHandler(RuntimeException ex){
        System.out.println("exception Handler");
        return "redirect:error.jsp";
    }

方式二

<bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
        <property name="exceptionMappings">
            <props>
                <prop key="java.lang.RuntimeException">redirect:error.jsp</prop>
            </props>
        </property>
    </bean>

  

SpringMVC 异常处理

原文:http://www.cnblogs.com/yanqin/p/5828376.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!