title: Using <mvc:resources .../> in spring 3 causes all other views to stop working
body: <p>Simplest example:</p>
  
  <p>I have a dispatcher servlet configured to catch everything:</p>
  
  <pre><code>&lt;servlet-mapping&gt;
      &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>I have a simple test controller:</p>
  
  <pre><code>@RequestMapping("/index")
  @ResponseBody
  public String rootTest(){
      return "Main page displayed from TestController";
  }
  </code></pre>
  
  <p>In this test case I am adding (or removing) the following line to <code>dispatcher-servlet.xml</code>:</p>
  
  <pre><code>&lt;mvc:resources mapping="/public/**" location="/public/"/&gt;
  </code></pre>
  
  <p><strong>My lofty goal:</strong> to serve static content (images, css, js) along with my dynamic content (generated via Velocity within a Jetty servlet container, tied together with the almighty Spring).</p>
  
  <p><strong>My Dilema:</strong> When I add <code>&lt;mvc:resources .../&gt;</code> I get a 404 for <code>http://localhost/index</code>, but I can serve an image from <a href="http://localhost/public/img/42.png" rel="noreferrer">http://localhost/public/img/42.png</a>. If I remove <code>&lt;mvc:resources .../&gt;</code> then <code>http://localhost/index</code> works fine, but of course, how do I serve static content?</p>
  
  <p><strong>Bonus question:</strong> Why can I never have my cake and eat it too?</p>