Created
October 25, 2011 20:41
-
-
Save aheusingfeld/1314197 to your computer and use it in GitHub Desktop.
Customize exception JSP and Spring MVC config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- <p> | |
- <spring:message code="error_uncaughtexception_problemdescription" /> | |
- </p> | |
<c:if test="${not empty exception}"> | |
- <p> | |
- <h4> | |
- <spring:message code="exception_details" /> | |
- </h4> | |
- <spring:message var="message" code="exception_message" htmlEscape="false" /> | |
- <util:panel id="_message" title="${message}" openPane="false"> | |
- <c:out value="${exception.localizedMessage}" /> | |
- </util:panel> | |
+ <p> | |
+ <b><spring:message code="${exception.message}" /></b> | |
+ </p> | |
+ <p><h4><spring:message code="exceptions_originalmessage" />: </h4> | |
+ <ul> | |
+ <li><c:out value="${exception.rootCause.message}" /></li> | |
+ <li><c:out value="${exception.originalException.message}" /></li> | |
+ </ul> | |
+ </p> | |
+ <p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- <bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver" p:defaulterrorview="uncaughtException"> | |
+ <bean class="de.goldstift.photoo.web.exceptions.I18nMappingExceptionResolver" p:defaulterrorview="uncaughtException" p:defaultmessage="exceptions.unexpected"> | |
<property name="exceptionMappings"> | |
<props> | |
- <prop key=".DataAccessException">dataAccessFailure</prop> | |
+ <prop key=".AnalyzedApplicationException">uncaughtException</prop> | |
<prop key=".NoSuchRequestHandlingMethodException">resourceNotFound</prop> | |
<prop key=".TypeMismatchException">resourceNotFound</prop> | |
<prop key=".MissingServletRequestParameterException">resourceNotFound</prop> | |
</props> | |
</property> | |
+ <property name="messageMapping"> | |
+ <map> | |
+ | |
+ <entry value="exceptions.db.duplicateentry"> | |
+ <key> | |
+ <bean class="de.goldstift.photoo.web.exceptions.MessageMatchCriteria" p:classnamepart="ConstraintViolationException" p:messagepart="Duplicate entry"> | |
+ </bean></key> | |
+ </entry> | |
+ <entry value="exceptions.db.constraint"> | |
+ <key> | |
+ <bean class="de.goldstift.photoo.web.exceptions.MessageMatchCriteria" p:classnamepart="ConstraintViolationException"> | |
+ </bean></key> | |
+ </entry> | |
+ </map> | |
+ </property> | |
</bean> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment