Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring - WARNING: No mapping found for HTTP request with URI
    primarykey
    data
    text
    <p>I'm new to Spring, been reading a whole lot but I cannot figure out why this doesn't work. I've included the relevant parts below... <br /> <br /> web.xml:</p> <pre><code>&lt;servlet&gt; &lt;servlet-name&gt;display&lt;/servlet-name&gt; &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;display&lt;/servlet-name&gt; &lt;url-pattern&gt;*.p&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; </code></pre> <p><br /> display-servlet.xml:</p> <pre><code>&lt;mvc:annotation-driven /&gt; &lt;context:component-scan base-package="com" /&gt; &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" /&gt; </code></pre> <p><br /> displayController.java:</p> <pre><code>package com; @Controller public class displayController { @RequestMapping("/display") public ModelAndView displayName() { System.out.println("-- in handleRequest"); ModelAndView mv = new ModelAndView("display"); user u = new user(); u.setUsername("bob"); mv.addObject("user", u); return mv; } } </code></pre> <p><br /> Now, as far as I know, this is what I think happens, but it isn't.. <br /> <br /> <b>1.</b> I go to a url "/user/display.p" <br /> <b>2.</b> Application looks in the web.xml, finds the url pattern "*.p" and notices it should be linked with the servlet display. Then an instance of DispatcherServlet is created and the context in display-servlet.xml is loaded. <br /> <b>3.</b> When display-servlet.xml is loaded, it notices the mvc:annotation-driven and does something (not really sure I understand that one yet, but I think I need it. Then, it notices the component-scan and scans through the "com" package, of which displayController is located. <br /> <b>4.</b> displayController is searched for annotations and it finds it is a controller, and also any url with "/display" in it should automatically trigger the displayName() function. <br /> <b>5.</b> [Somewhere in here things break...] <br /> <b>6.</b> Then, what SHOULD happen (but doesn't) is the view "display" should be loaded and the "/WEB-INF/jsp/display.jsp" should be loaded. However, no view "display" is found and I receive the error "WARNING: No mapping found for HTTP request with URI [/testing/user/display.p] in DispatcherServlet with name 'display'"</p> <p>Can anyone help me on this?</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    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.
    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