web.xml中标签的定义顺序

昨天晚上在部署tomcat以后,报找不到某个taglib的错误,解析web.xml文件发生了异常。

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

web.xml是使用 web-app_2_3.dtd作为参考来解析的 --

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
                         "http://java.sun.com/dtd/web-app_2_3.dtd">


在网上找了下关于这个dtd文件的详细分析: 

http://blog.csdn.net/gztoby/archive/2004/08/11/71871.aspx

其中有一段:

<!ELEMENT web-app (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,发现session-config的定义放在了taglib定义之后,所以会报错。

原文地址:https://www.cnblogs.com/mabaishui/p/2051716.html