title: jsp / spring-mvc exception on render - how to get custom error page and log the exception
body: <p>If an exception occurs in the service or controller, it is handled by spring's HandlerExceptionResolvers. However, if there is an exception in a .jsp processing (for example - <code>PropertyNotFoundException</code>, happens even with JSTL), then spring does not pass this through its exception handling mechanism. Further more, it is not considered an error 500, so the <code>&lt;error-page&gt;</code> configuration is not taken into account</p>
  
  <p>Instead, the exception is propagated to the servlet container. Which is fine, but I can't actually get the behaviour I want:</p>
  
  <ul>
  <li>show a (500) error page </li>
  <li>log the exception</li>
  </ul>
  
  <p>My current setup:</p>
  
  <ul>
  <li>the 500.jsp has <code>isErrorPage=true</code></li>
  <li>all jsps include a common file, which has <code>&lt;%@ page errorPage="500.jsp" %&gt;</code></li>
  </ul>
  
  <p>What happens is - the exception is not recorded anywhere. And the error page is not shown. Instead, the requested page is shown half-rendered. If I increase the buffer size (enough to reach the problematic piece of code), only then the error page is shown. (again, no logging)</p>
  
  <p>So, how do I achieve what I want? Without changing the buffer size, without using <code>&lt;c:catch&gt;</code>, and without <code>ex.printStackTrace()</code> in the error page)</p>