To simplify the example from the previous SPRINGMVC project, the following error occurred:
No mapping found for HTTP request with URI [/rbiz4/uploadfile.html]
The above message was found from the MyEclipse console.
This message refers to the/rbiz4/uploadfile.html such a request can not find the corresponding information, and then check
1.jsp file
2.controller file
3.web.xml
Found:
1.jsp file The action of the form is uploadfile.html, yes.
The requestmapping of the 2.controller file is @requestmapping (value= "/uploadfile").
In 3.web.xml, the portion of the request to the HTML suffix to SPRINGMVC processing is
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
All three are right, so where is wrong?
Then there is only one possibility, controller class SPRINGMVC do not know, so open spring-servlet.xml, found a controller information
<!--scan the classed marked with @Controller annotation under the package Com.controller-
<context:component-scan base-package= "Com.company.controller"/>
should also be modified to actual
<!--scan the classed marked with @Controller annotation under the package Com.controller-
<context:component-scan base-package= "Com.cp.ctrl"/>
In this way, the controller class will be recognized by SPRINGMVC, not the class name with a @controller annotation on it.
August 1, 2016 23:46:46
Issue "No mapping found for HTTP request with URI [/rbiz4/uploadfile.html]" resolution