Thinking

兵胜非常事,要善于总结

yiluo-----web.xml语句顺序问题

文章来源:http://blog.csdn.net/yiluoak_47/article/details/12070253

报错信息

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*)"

 原因和DTD 的格式要求有关,原文摘录如下:

==================================================

So for the 2.3 version of the DTD, you have to put the tags in the correct order. You have:
<web-app>  <servlet></servlet>  <servlet-mapping></servlet-mapping>  <servlet></servlet>  <servlet-mapping></servlet-mapping>  <servlet></servlet>  <servlet-mapping></servlet-mapping>  <!-- ... -->  <listener></listener></web-app>


But the DTD says it must be:
<web-app>  <listener></listener>  <servlet></servlet>  <servlet></servlet>  <servlet></servlet>  <!-- ... -->  <servlet-mapping></servlet-mapping>  <servlet-mapping></servlet-mapping>  <servlet-mapping></servlet-mapping>  <!-- ... --></web-app>

======================================

The error message tells you the order they must be in:

 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*)"

Means the order is:
icon (0 or 1 times)display-name (0 or 1 times)description (0 or 1 times)distributable (0 or 1 times)context-param (0 or more times)filter (0 or more times)filter-mapping (0 or more times)listener (0 or more times)servlet (0 or more times)servlet-mapping (0 or more times)session-config (0 or 1 times)mime-mapping (0 or more times)welcome-file-list (0 or 1 times)error-page (0 or more times)taglib (0 or more times)resource-env-ref (0 or more times)resource-ref (0 or more times)security-constraint (0 or more times)login-config (0 or 1 times)security-role (0 or more times)env-entry (0 or more times)ejb-ref (0 or more times)ejb-local-ref (0 or more times)

==============================

i also want to know that 
are tags supposed to be in some order in version 2.4, or i can have them in any order ? 


Answer:   

The 2.4 spec can be in any order.

阅读更多
上一篇yiluo-----Eclipse 插件Maven在使用 add dependency,找不到包,解决办法
下一篇Linux安装MySQL的两种方法{linux系统mysql安装之前需要先检查是否已经安装,把已经有的库文件卸载掉,否则会出现覆盖错误}
想对作者说点什么? 我来说一句

Oracle SQL性能

2012年03月28日 329KB 下载

没有更多推荐了,返回首页

关闭
关闭