SmileFace
          與java一起走過的日子
          posts - 41,  comments - 8,  trackbacks - 0

          這2天tomcat總是出問題,不能正常啟動,錯誤如下: org.xml.sax.SAXParseException: 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 的格式要求有關,原文在:

          我copy了基本要點:

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

          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.

          posted on 2006-05-22 13:02 SmileFace 閱讀(1786) 評論(1)  編輯  收藏

          FeedBack:
          # re: Tomcat中web.xml語句順序有講究。
          2007-03-08 16:32 | ehow
          你們都去吃屎吧  回復  更多評論
            

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           

          <2006年5月>
          30123456
          78910111213
          14151617181920
          21222324252627
          28293031123
          45678910

          常用鏈接

          留言簿(2)

          隨筆分類

          隨筆檔案

          文章檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 花莲市| 遂昌县| 华池县| 四子王旗| 吉隆县| 安达市| 寿阳县| 苍梧县| 赤壁市| 呼和浩特市| 山阴县| 那坡县| 北碚区| 房产| 平定县| 凤台县| 延吉市| 汕头市| 浮梁县| 新泰市| 霍州市| 威信县| 恩平市| 扬中市| 景泰县| 大渡口区| 芜湖市| 镇宁| 汝城县| 广西| 湖北省| 嘉峪关市| 定陶县| 酉阳| 凉城县| 兴城市| 河南省| 沙洋县| 乃东县| 师宗县| 云林县|