关于web.xml中<web-app>报错解决方案

来源:互联网 发布:岛国软件免费下载 编辑:程序博客网 时间:2024/05/02 02:04

严重: Parse Error at line 31 column 11: 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*)"

查阅网上资料大部分给出的意见是,应严格按照icon?,display-name?,description?,distributable等等这种顺序添加节点。 按照此法仔细对照修改后,错误终于消失了。还有一种说法是把  <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">这一段校验代码删掉,问题就解决了。原因是:自己添加的部分代码符合xml文档规范,但不符合web-app_2_3.dtd所定义的规范。不过还没遇到过此种情况,留着备用。

2 0