Issue "No mapping found for HTTP request with URI [/rbiz4/uploadfile.html]" resolution

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.