我在web.xml中的web-app声明是:
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
Run Code Online (Sandbox Code Playgroud)
eclipse抱怨所有4个属性,这里有一个Eclipse抱怨:
Attribute "version" must be declared for element type "web-app"
Run Code Online (Sandbox Code Playgroud)
Eclipse为什么抱怨这些属性?我在这里做错了吗?
小智 12
试着这样说:
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4" >
Run Code Online (Sandbox Code Playgroud)
Eclipse验证器对订单非常严格.
Ari*_*ain 10
我有同样的问题.我尝试了不同的架构位置,它对我有用.代替
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
尝试使用这个
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd
另外,将版本设置为"3.0".