I\'ve created exception handling in my Spring application using spring SimpleMappingExceptionResolver. Everything works fine. Now I need to somehow print the caught exceptio
Had to do this (dev/local environment only) in pages in the past and just want to display it in a textarea or a preformatted block. The output from skaffman prints out each strack trace element but not the message and exception class.
If you want it pre-formatted as per a printStackTrace() consider using Spring EL and commons-lang3.
<spring:eval expression="T(org.apache.commons.lang3.exception.ExceptionUtils).getStackTrace(exception)"/>
The easiest solution I can think of is to loop over the stack trace elements, taking advantage of the Throwable.getStackTrace()
method:
<c:forEach items="${exception.stackTrace}" var="element">
<c:out value="${element}" />
</c:forEach>
You'd need to add some formatting, of course.