<p>From a jsp is thrown a NullPointerException for example using  <code>&lt;% null.toString(); %&gt;</code></p>

<p>This exception is not handled by the HandlerExceptionResolver, but thrown to the web container(tomcat) and converted into a <code>code 500 error</code>.</p>

<p>How can I configure spring to get that error in my HandlerExceptionResolver ?</p>

<p>Details:</p>

<ul>
<li>Spring can be configured to handle exceptions thrown inside Controllers, but not exceptions thrown by view.</li>
<li>Of course i can resolve the NullPointerException, but i want to design a solution that will gracefully resolve any possible problem on the web application in order to display a user friendly message to the user.</li>
</ul>

I have not worked with this particular bit of the spring framework, but the docs say
"Interface to be implemented by objects than can resolve exceptions thrown during handler mapping or execution, in the typical case to error views. Implementors are typically registered as beans in the application context.
Error views are analogous to the error page JSPs, but can be used with any kind of exception including any checked exception, with potentially fine-granular mappings for specific handlers."
so I'd imagine that given that NullPointer extends RuntimeException the framework isn't designed to catch it. Is there a reason the exception(s) can't be handled in the controller directly?