1.在web.xml中代码如下
<servlet> <servlet-name>springDispatcherServlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:springMvc-*.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>springDispatcherServlet</servlet-name> <!-- <url-pattern>*.do</url-pattern> --> <url-pattern>/</url-pattern> </servlet-mapping>
2.在springMVC配置文件中添加如下代码