The content of element type "web-app" must match "( ***
WEB项目报错
The content of element type "web-app" must match "(icon?,display-name?,description?,distributable?,context-param,filter,filter- mapping,listener,servlet,servlet-mapping,session-config?,mime-mapping,welcome-file-list?,error-page,taglib,resource-env-ref,resource- ref,security-constraint,login-config?,security-role,env-entry,ejb-ref,ejb-local-ref)".
原因
web.xml头文件比较旧。规定了代码的书写顺序所以报错。
解决方案
按照规定的顺序写代码。或者替换头文件为其他版本。
web.xml v2.5
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
</web-app>
web.xml v3.0
<?xml version="1.0" encoding="UTF-8"?>
<web-app
version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
</web-app>
如果这篇文章对你有用,可以关注本人微信公众号获取更多ヽ(^ω^)ノ ~
![微信公众号二维码](https://images.cnblogs.com/cnblogs_com/aeolian/1679458/o_wechat_gzh_qrcode.jpg)