Spring MVC4未找到使用maven的URI为HTTP请求的映射
我正在使用maven创建Spring4MVC应用程序 将“maven原型webapp”作为artifactId和 添加依赖项“SpringCore”、“SpringWeb”、“SpringMVC” 下面是“web.xml”和“hellowebservlet.xml” web.xmlSpring MVC4未找到使用maven的URI为HTTP请求的映射,maven,spring-mvc,spring-4,Maven,Spring Mvc,Spring 4,我正在使用maven创建Spring4MVC应用程序 将“maven原型webapp”作为artifactId和 添加依赖项“SpringCore”、“SpringWeb”、“SpringMVC” 下面是“web.xml”和“hellowebservlet.xml” web.xml <web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLS
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
<display-name>Spring MVC Application</display-name>
<servlet>
<servlet-name>HelloWeb</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>HelloWeb</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
</web-app>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">
<context:component-scan base-package="com.zap.pm.*" />
<mvc:annotation-driven />
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
我已将hello.jsp放在“/WEB-INF/jsp/”中
但在访问请求“”时
它给出了以下错误
Oct 12, 2015 7:10:13 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound
WARNING: No mapping found for HTTP request with URI [/webappspring/test.html] in DispatcherServlet with name 'HelloWeb'
我已经访问了这里更细的问题,但没有一个能解决我的问题。将上下文更改为:组件扫描基本包路径为此,您不需要星号:
<context:component-scan base-package="com.zap.pm" />
将您的上下文:组件扫描基本包路径更改为此,您不需要星号:
<context:component-scan base-package="com.zap.pm" />
请检查您的应用程序的文件夹结构,我遇到了相同的问题,mine controller位于src/main/resources文件夹中,而不是src/main/java请检查您的应用程序的文件夹结构,我遇到了相同的问题,mine controller位于src/main/resources文件夹中,而不是src/main/java我已尝试如您所述删除星号,但仍有相同的错误。只需将J2SE环境更改为java-7或更高版本。我已尝试如您所述删除星号,但是还是有同样的错误。只要把你的J2SE环境改成Java-7或higherYes它对我有用,现在我关心的是为什么maven没有创建那个文件夹结构,我必须手动创建它。只要把你的J2SE环境改成Java-7或higherYes它对我有用,现在我关心的是为什么maven没有创建那个文件夹结构,我必须手动创建它。只需将J2SE环境更改为Java-7或更高版本