From a jsp is thrown a NullPointerException for example using <% null.toString(); %>

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

How can I configure spring to get that error in my HandlerExceptionResolver ?

Details:

  • Spring can be configured to handle exceptions thrown inside Controllers, but not exceptions thrown by view.
  • 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.
Edit
Report