Spring & Tomcat – custom errors

In spending a few hours on trying to get the error-page tag in tomcat’s web.xml working, i’ve found a better way to do it – one which uses spring to take on exception handling rather than Tomcat itself – something which also lets spring give the error-page visibility on other view-objects and business-rules.

Simple enough to implement and works wonderfully! 🙂

Eg;

<bean>
<property name="exceptionMappings">
<map>
<entry key="project.exception.RecordNotFoundException" value="recordNotFoundException" />
</map></property>
</bean>

http://developingdeveloper.wordpress.com/2008/03/09/handling-exceptions-in-spring-mvc-part-2/

Leave a Reply