title: Spring MVC URI template problem
body: <p>In Spring MVC 3 on Tomcat 6, I can't seem to get RequestMappings of the form /x/y/z to work.  /x/y seems to work fine and that's what all the example in docs show.</p>
  
  <p>For example, why does this work</p>
  
  <pre><code>@RequestMapping(value="/browse/{categoryName}"); 
  </code></pre>
  
  <p>but this is doesn't work:</p>
  
  <pre><code>@RequestMapping(value="/browse/category/{categoryName}");
  </code></pre>
  
  <p>Browsing to <a href="http://localhost:8080/myapp/browse/category/books" rel="nofollow">http://localhost:8080/myapp/browse/category/books</a> generates a HTTP 404 from Tomcat.  The method looks like this:</p>
  
  <pre><code>@Controller
  public class BrowseController {
      @RequestMapping(value = "/browse/category/{categoryName}", method = RequestMethod.GET)
      public String showCategory(@PathVariable("categoryName") String categoryName, Model model) {
          model.addAttribute("categoryName", categoryName);
          return "Browse";
      }
  }
  </code></pre>
  
  <p>I see this message in the Tomcat output window in Netbeans 6.9:</p>
  
  <pre><code>Nov 14, 2010 2:02:03 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound
  WARNING: No mapping found for HTTP request with URI [/myapp/browse/category/model] in DispatcherServlet with name 'dispatcher'
  </code></pre>
  
  <p>EDIT:  added more tracing info from the log.  Please disregard the timestamps since this questions was edited over two days.</p>
  
  <p>Upon deploying the app:</p>
  
  <pre><code>Nov 15, 2010 9:33:28 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
  INFO: Refreshing WebApplicationContext for namespace 'dispatcher-servlet': startup date [Mon Nov 15 21:33:28 EST 2010]; parent: Root WebApplicationContext
  Nov 15, 2010 9:33:28 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
  INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/dispatcher-servlet.xml]
  Nov 15, 2010 9:33:29 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
  INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@143c423: defining beans [browseController,homeController,showController,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping#0,viewResolver]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@1ea763a
  Nov 15, 2010 9:33:29 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
  INFO: Mapped URL path [/browse] onto handler 'browseController'
  Nov 15, 2010 9:33:29 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
  INFO: Mapped URL path [/browse/*] onto handler 'browseController'
  Nov 15, 2010 9:33:29 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
  INFO: Mapped URL path [/home] onto handler 'homeController'
  Nov 15, 2010 9:33:29 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
  INFO: Mapped URL path [/home/*] onto handler 'homeController'
  Nov 15, 2010 9:33:29 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
  INFO: Mapped URL path [/show] onto handler 'showController'
  Nov 15, 2010 9:33:29 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
  INFO: Mapped URL path [/show/*] onto handler 'showController'
  Nov 15, 2010 9:33:29 PM org.springframework.web.servlet.FrameworkServlet initServletBean
  INFO: FrameworkServlet 'dispatcher': initialization completed in 501 ms
  </code></pre>
  
  <p>When I made the call to <a href="http://localhost:8080/myapp/browse/category/model" rel="nofollow">http://localhost:8080/myapp/browse/category/model</a>,</p>
  
  <pre><code>Nov 15, 2010 9:34:28 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound
  WARNING: No mapping found for HTTP request with URI [/myapp/browse/category/model] in DispatcherServlet with name 'dispatcher'
  </code></pre>
  
  <p>And here's my web.xml dispatcher config:</p>
  
  <pre><code>&lt;servlet&gt;
          &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;2&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
      &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>So is there any reason why I URI pattern works but the other doesn't?</p>