在web.xml文件中添加
<servlet><servlet-name>dispatcher</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class><init-param><param-name>contextConfigLocation</param-name><param-value>
classpath:spring-mvc.xml
</param-value></init-param><load-on-startup>1</load-on-startup></servlet><servlet-mapping><servlet-name>dispatcher</servlet-name><url-pattern>*.do</url-pattern><url-pattern>*.json</url-pattern><url-pattern>*.xml</url-pattern></servlet-mapping>
即可