title: Spring + Tiles - Show error page without changing URL?
body: <p>How would I go about showing users a generic error page (such as 404) without changing the URL in the browser?</p>
  
  <p>So for example, if the user goes to a page <code>/happy/fun/times</code> but no such tiles view/mapping exists in my web application, I want the URL to stay as <code>/happy/fun/times</code> but show them the tiles view of <code>/error/404</code> instead.</p>
  
  <p>Also, on a related note how would I do this with all errors, such as 500 errors or 403 errors? Or even exceptions that somehow may get through?</p>
  
  <p>I've tried using the web.xml to do the following:</p>
  
  <pre><code>&lt;error-page&gt;
      &lt;error-code&gt;500&lt;/error-code&gt;
      &lt;location&gt;/error/500&lt;/location&gt;
  &lt;/error-page&gt;
  &lt;error-page&gt;
      &lt;error-code&gt;404&lt;/error-code&gt;
      &lt;location&gt;/error/404&lt;/location&gt;
  &lt;/error-page&gt;
  &lt;error-page&gt;
      &lt;error-code&gt;403&lt;/error-code&gt;
      &lt;location&gt;/error/403&lt;/location&gt;
  &lt;/error-page&gt;
  &lt;error-page&gt; 
      &lt;exception-type&gt;java.lang.Throwable&lt;/exception-type&gt; 
      &lt;location&gt;/error/general&lt;/location&gt; 
  &lt;/error-page&gt;
  </code></pre>
  
  <p>however that doesn't seem to work. If I want, I can change the location to '/WEB-INF/jsp/error/404.jsp', then the 404 errors are caught by the web.xml. However, then it just displays the contents of the '404.jsp' file instead of the tiles view '/error/404' that I actually want displayed.</p>