Note that there are some explanatory texts on larger screens.

plurals
  1. POspring-mvc: how to map URI templates in the form of "a/b/{c}"?
    primarykey
    data
    text
    <p>I can get a URI template in the form of "/a/b" or "/a/{b}" to work. But when I try "/a/b/{c}", I get a HTTP 404 and a message in the log in the form of "No mapping found for HTTP request with URI [/myapp/a/b/c]..." But I see these message in the log also which leads me to believe that the mappings are correct...?</p> <pre><code>INFO: Mapped URL path [/a] onto handler 'AController' Nov 16, 2010 12:18:39 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler INFO: Mapped URL path [/a/*] onto handler 'AController' Nov 16, 2010 12:18:39 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler </code></pre> <p>I noticed all <a href="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/mvc.html#mvc-ann-requestmapping-uri-templates" rel="nofollow">the examples in the spring-mvc docs</a> show URI templates in the form of "/a/{b}" or /a/{b}/c/{d}". So is "/a/b/{c}" not possible? Is there anything I need to configure in web.xml to make this happen? Or can some (mis)configuration prevent that pattern from being mapped? Currently my dispatcher servlet is mapped to: </p> <pre><code>&lt;url-pattern&gt;/&lt;/url-pattern&gt; </code></pre> <p>The controller looks like this:</p> <pre><code>@Controller public class AController { @RequestMapping(value = "/a/b/{c}", method = RequestMethod.GET) public ModelAndView show() { ModelAndView modelAndView = new ModelAndView("A"); return modelAndView; } } </code></pre> <p>Accessing <a href="http://localhost:8080/myapp/a/b/c" rel="nofollow">http://localhost:8080/myapp/a/b/c</a> returns a 404 and I see this in the log:</p> <pre><code>Nov 16, 2010 12:19:06 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound WARNING: No mapping found for HTTP request with URI [/myapp/a/b/c] in DispatcherServlet with name 'dispatcher' </code></pre> <p>Any ideas on how I get my URI pattern to get mapped correctly?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload