spring mvc 启动时报错html
Could not open ServletContext resource [/WEB-INF/appServlet-servlet.xml
全局搜索也没有找到appServlet-servlet.xml相关的文件java
缘由是springMVC启动时,在web.xml中若是未指定servlet.xml目标文件,web
则自动搜索[servlet-name]-servlet.xml文件,没有此名称的servlet.xml文件,因此报错了。spring
指定文件方法:经过<init-param>mvc
附完整web.xml文件app
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> <display-name>Spring MVC Application</display-name> <servlet> <servlet-name>appServlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring/servlet-context.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>appServlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> </web-app>