肥皂起泡泡
通过Spring mvc框架提供的SimpleMappingExceptionResolver来集中处理,该类可以捕获所有控制器抛出的异常,并将它映射到配置的视图中。用法配置如下:<bean id="exceptionResolver"class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"><property name="defaultErrorView"><value>failure</value></property><property name="exceptionMappings"><props><prop key="java.sql.SQLException">showDBError</prop><prop key="java.lang.RuntimeException">showError</prop></props></property></bean>