The content of element type "web-app" must match "

本文介绍了解决 Eclipse 中因 web.xml 文件配置错误导致的问题。错误表现为元素类型 'web-app' 的内容不符合预期模式。文章提供了两种解决方案:一是调整 web.xml 文件中的节点顺序;二是关闭 Eclipse 的 XML 校验功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

导入工程,eclipse中报错:

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中可能顺序不对,比如servlet和servlet-mapping交叉出现或者filter和filter-mapping交叉

参考http://stackoverflow.com/questions/5712906/getting-error-the-content-of-element-type-web-app-must-match

解决方法有两种:

1.调整web.xml中节点顺序,先servlet再servlet-mapping(filter同理)

2.关闭eclipse中xml校验,步骤:Windows-Preference-Validation,disable all,apply再OK

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值