第一次自学springmvc的时候,老是报错Could not open ServletContext resource [/WEB-INF/springmvc-servlet.xml],郁闷的不要不要的。按照配置规则重新检查了一遍,没看出问题来,上网搜了一下说在web.xml里面加入:
<servlet> <servlet-name>springmvc</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/pringMVC-servlet.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>springmvc</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping>