1 <?xml version="1.0" encoding="UTF-8"?> 2 <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" id="WebApp_ID" version="2.5"> 3 <display-name>02-returnVoid-ajax</display-name> 4 <filter> 5 <filter-name>CharacterEncodingFilter</filter-name> 6 <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> 7 <init-param> 8 <param-name>encoding</param-name> 9 <param-value>utf-8</param-value> 10 </init-param> 11 <init-param> 12 <param-name>forceEncoding</param-name> 13 <param-value>true</param-value> 14 </init-param> 15 </filter> 16 <filter-mapping> 17 <filter-name>CharacterEncodingFilter</filter-name> 18 <url-pattern>/*</url-pattern> 19 </filter-mapping> 20 <servlet> 21 <servlet-name>springMVC</servlet-name> 22 <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 23 <init-param> 24 <param-name>contextConfigLocation</param-name> 25 <param-value>classpath:springMVC.xml</param-value> 26 </init-param> 27 <load-on-startup>1</load-on-startup> 28 </servlet> 29 <servlet-mapping> 30 <servlet-name>springMVC</servlet-name> 31 <url-pattern>*.do</url-pattern> 32 </servlet-mapping> 33 <welcome-file-list> 34 <welcome-file>index.jsp</welcome-file> 35 </welcome-file-list> 36 </web-app>
运行后老出现下图的路径错误
你部署的根路径是 /02-return...这个,启动后自然进入的是你的根设置
试试把这个'/'去掉