SpringMVC异常处理
1.通过配置
<bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<property name="exceptionMappings">
<props>
<prop key="java.lang.RuntimeException">redirect:/error.jsp</prop>
</props>
</property>
</bean>
2、在controller中添加异常处理handler
@ExceptionHandler(RuntimeException.class)
public String exception(RuntimeException ex){
return "redirect:/error.jsp";
}