SimpleMappingExceptionResolver是用来处理框架产生的异常,我们可以配置产生异常时转向的页面及异常返回的属性名等信息,具体的配置如下是springmvc配置文件中的配置:
<!-- 配置SimpleMappingExceptionResolver异常处理 --><bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"><property name="exceptionAttribute" value="exception"></property><property name="exceptionMappings"><props><prop key="java.lang.ArrayIndexOutOfBoundsException">error</prop></props></property></bean>
其中exceptionAttibute属性是异常信息返回到页面上的属性名:默认为exception,可以在SimpleMappingExceptionResolver类中看到
exceptoinMappings中配置的是具体发生的异常映射到的视图