@Controller public class Myexection { @RequestMapping("/list") public String exe(){
int resule=5/0;//异常 return "/list.jsp"; } }
配置中:
<!--开启异常--> <bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"> <property name="defaultErrorView" value="exection.jsp"></property> </bean>
在这里我给了一个算数异常,发现异常不会执行下面代码,会走到配置文件中找到 exection.jsp这个页面