title: Struts 2 custom 404 error page never shows
body: <p>I'm using the Struts 2 framework for a webapp. While trying to create a custom 404 error page I discovered Struts 2 is doing more work for me then intended.</p>
  <p>I only use a <code>struts.xml</code> and a <code>web.xml</code> file. In the <code>web.xml</code> file I added the following code:</p>
  <pre><code>&lt;error-page&gt;
      &lt;error-code&gt;404&lt;/error-code&gt;
      &lt;location&gt;/error/Error404.jsp&lt;/location&gt;
  &lt;/error-page&gt;
  </code></pre>
  <p>Now, when I start my webapp it goes to the homepage as usual. When I try urls of this type (all urls that don't exist):</p>
  <pre><code>http://localhost:8080/MyWebApp/fhgfhfhfhgfhgfhfhfh
  http://localhost:8080/MyWebApp/fhgfhfhfhgfhgfhfhfh.action
  </code></pre>
  <p>Struts will process the request, run the interceptors, and automatically redirect to the default page. I would have expected my 404 error page to be shown on these pages. I even removed this line in <code>struts.xml</code> but it still redirects!</p>
  <pre><code>&lt;default-action-ref name=&quot;index&quot; /&gt;
  </code></pre>
  <p>When I use the following URL:</p>
  <pre><code>http://localhost:8080/MyWebApp/fhgfhfhfhgfhgfhfhfh.jsp
  </code></pre>
  <p>Struts just shows a blank screen and no request is being processed (no interceptors, no redirecting...). I find this weird too because I don't see what's invalid about that request (other than the JSP file that doesn't exist)</p>
  <p>So I guess I need to modify my <code>struts.xml</code> so I can override some default redirecting behaviour (I don't want the 404 error to be covered up by going to the homepage), and my <code>web.xml</code> to also handle any arbitrary obscure requests (so any URL that is being typed in by the user will at actually be handled instead of just showing blank screens. What am I missing in my configuration?</p>
  <p>PS: I'm not talking about Java exceptions/errors, but only the HTTP errors. The Java exceptions are handled properly like I want them to behave.</p>