title: Filter mapping in Spring MVC is not working on some URL
body: <p>I am using HTML Filter to delete white spaces from out put of my jsp pages and servlets. I am learning JSP development with Spring MVC. So I am using filter mapping and error page with web.xml file and my web.xml codes are </p>
  
  <pre><code>&lt;servlet&gt;
      &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;error-page&gt;
      &lt;error-code&gt;404&lt;/error-code&gt;
      &lt;location&gt;/error404&lt;/location&gt;
  &lt;/error-page&gt;
  
  &lt;filter&gt;
      &lt;filter-name&gt;whitespaceFilter&lt;/filter-name&gt;
      &lt;filter-class&gt;test.web.htmlminify.HTMLMinifyFilter&lt;/filter-class&gt;
  &lt;/filter&gt;
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;whitespaceFilter&lt;/filter-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  </code></pre>
  
  <p>And I have three controllers with no methods but only returning pages which are </p>
  
  <pre><code>HomeController, TestController, Error404Controller
  </code></pre>
  
  <p>which has homePage(), testPage() and errorPage() method which are returning following ,</p>
  
  <pre><code>return "home";
  return "test";
  return "error";
  </code></pre>
  
  <p>And I do have one jsp file outside of WEB-INF folder named abc.jsp file.</p>
  
  <p>So situation is that when I access <code>localhost, localhost/abc.jsp, localhost/testpage</code> and <code>localhost/error404</code> </p>
  
  <p>the filter mapping is working, as when I see source code of html webpage in browser, there is not white space in it but when i try to access <code>localhost/ashhjb</code> or <code>localhost/kjdhvid/sdvfdjiu</code> anything like that, filter mapping is not working. It means I am seeing white spaces in html pages when servlet is calling 'error' page instead of direct error controller method in browser. <code>localhost/error404</code> is direct call to error page servlet. So can anyone help me and suggest me what should I do?</p>
  
  <p>Thanx for helping in advance.</p>