在配置web.xml的時候總是報cvc-complex-type.2.4.a: Invalid content was found starting with element 錯誤,還出現小紅叉。
可以嘗試以下兩種解決方式:
解決方法一:
在eclipse中配置xml
1、 http://www.springmodules.org/schema/cache/springmodules-cache.xsd
2、http://www.springmodules.org/schema/cache/springmodules-ehcache.xsd
然后再將這兩個xsd加入到web.xml中就搞定了 ,如下面代碼:
解決方法二:
<async-supported>true</async-supported>是web.xml 3.0的新特性,只需將
<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">
改成:
<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_3_0.xsd" id="WebApp_ID" version="3.0">
即可解決。