title: Spring MVC - handle exception with @ExceptionHandler doesn't render new view
body: <p>I seem to be up against a limitation of Spring - I have a simple case to handle - I'm simulating an exception from a service method: </p>
  
  <pre><code>@RequestMapping( method = RequestMethod.POST )
  public String register( @RequestParam( "mail" ) String mail ){
      throw new IllegalStateException();
  }
  </code></pre>
  
  <p>and trying to handle the new request via: </p>
  
  <pre><code>@RequestMapping( value = "/exception_location" )
  @ExceptionHandler( IllegalStateException.class )
  public String handleException( IllegalStateException ex ){
      return "exception_view";
  }
  </code></pre>
  
  <p>my web.xml: </p>
  
  <pre><code>&lt;error-page&gt;
      &lt;exception-type&gt;java.lang.IllegalStateException&lt;/exception-type&gt;
      &lt;location&gt;/exception_location&lt;/location&gt;
  &lt;/error-page&gt;
  </code></pre>
  
  <p>What happens is that handleException does get triggered, but the exception view doens't get rendered on the client. 
  Is the Spring configuration OK or is the entry in web.xml not needed? Am I missing something that may be the reason of the handler not getting called?
  Any feedback is appreciated. 
  Thanks. </p>