获取错误:元素类型“web-app"的内容必须匹配, [英] Getting error: The content of element type "web-app" must match,

查看:24
本文介绍了获取错误:元素类型“web-app"的内容必须匹配,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在 Eclipse Helios Service Release 2 中构建我的项目时,我的 web.xml 中出现错误.请建议我为此必须做什么.在我的项目中,我使用的是 DTD 2.2.错误如下.

When I build my project in Eclipse Helios Service Release 2, I get an error in my web.xml. Please suggest what I have to do for this. In my project I am using DTD 2.2. The error is below.

元素类型web-app"的内容必须匹配(icon?,display-名称?,描述?,可分发的?,上下文参数*,servlet*,servlet-mapping*,会话配置?,mime-映射*、欢迎文件列表?、错误页面*、标签库*、资源引用*、安全约束*、登录配置?、安全-角色*,env-entry*,ejb-ref*)".

The content of element type "web-app" must match "(icon?,display- name?,description?,distributable?,context-param*,servlet*,servlet-mapping*,session-config?,mime- mapping*,welcome-file-list?,error-page*,taglib*,resource-ref*,security-constraint*,login-config?,security- role*,env-entry*,ejb-ref*)".

推荐答案

错误消息会详细告诉您应该以什么顺序放置元素以及允许放置多少个元素.换句话说,您的 web.xml 中元素的顺序或数量不正确.例如,根据错误信息, 需要 before .? 后缀表示可能有零个或一个.* 后缀表示可能有零个或多个.

The error message tells you in detail in what order the elements are supposed to be placed and how many of them are allowed. In other words, the ordering or amount of the elements inside the <web-app> of your web.xml is incorrect. For example, as per the error message, <servlet> needs to go before <servlet-mapping>. The ? suffix means that there may be zero or one of them. The * suffix means that there may be zero or many of them.

因此,下面的示例无效:

<servlet>...</servlet>
<servlet-mapping>...</servlet-mapping>

<servlet>...</servlet>
<servlet-mapping>...</servlet-mapping>

<servlet>...</servlet>
<servlet-mapping>...</servlet-mapping>

虽然下面的例子有效:

<servlet>...</servlet>
<servlet>...</servlet>
<servlet>...</servlet>

<servlet-mapping>...</servlet-mapping>
<servlet-mapping>...</servlet-mapping>
<servlet-mapping>...</servlet-mapping>

这篇关于获取错误:元素类型“web-app"的内容必须匹配,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆