Java spring MVC: no mapping found for HTTP request with http
•
Java
I had a problem setting up spring MVC... I have this project structure
-SpringTest<br /> -Java Resources -src -org.basic.controller FormController.java . . . . -WebContent +Meta-INF -WEB-INF dispatcher-servlet.xml +lib -views form.jsp web.xml
These are code pages:
web. In XML
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>Spring Web MVC Application</display-name> <servlet> <servlet-name>dispatcher</servlet-name> <servlet-class> org.springframework.web.servlet.DispatcherServlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern>*.htm</url-pattern> </servlet-mapping> </web-app>
Dispatcher servlet In XML
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" > <property name="prefix"> <value>/WEB-INF/views/</value> </property> <property name="suffix"> <value>.jsp</value> </property> </bean> </beans>
FormController. java
package org.basic.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping("/form.html") public class FormController { }
However, after deployment with JBoss, when I try to access "/ springtest / form. HTM", it will reply with this error:
Warn [org. Springframework. Web. Servlet. Pagenotfound] (http-localhost-127.0.0.1-8080-1) could not find the mapping of HTTP request with URI [/ springtest / form. HTM] in dispatcherservlet, with the name "dispatcher"
Solution
I see you don't have a scan controller
Also, why is your controller empty? Did you not paste the code just to make it look clear in the problem, or did you not write anything in the class
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码