Eclipse complaining about web-app attributes

2020-05-22 19:36发布

My web-app declaration in my web.xml is:

<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" >

And eclipse complains about all 4 attributes, here is one Eclipse complaint:

Attribute "version" must be declared for element type "web-app"

Why is Eclipse complaining about these attributes? Am I doing something wrong here?

7条回答
三岁会撩人
2楼-- · 2020-05-22 20:41

Try to put in this way:

<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" >

Eclipse validator is very strict with the order.

查看更多
登录 后发表回答