标签:
今天刚开始学习springMVC,因为工作要用到,就自己找了些例子学习,但是按照例子配置完成后启动就开始报错:-(,
具体错误:Could not open ServletContext resource [/WEB-INF/classes/spring-servlet.xml]
我的web.xml:
<!-- The front controller of this spring web application,
responsible for handling all application requests -->
<servlet>
<servlet-name>springmvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Map all requests to the DispatcherServlet for handling -->
<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
错误分析: 这报的FileNotFound,所以就是文件路径不对,在web.xml中配置的<servlet> 应该在WEB-INF下有一个其对应name的<servlet-name>-servlet.xml.本 来我是把springmvc-servlet.xml文件放在了src下,发布后就到了WEB-INF/classes/下了,所以就直接把springmvc-servlet.xml放在WEB-INF下问题就解决了
标签:
原文地址:http://www.cnblogs.com/ooToo/p/5570018.html