Myeclipse中java web.xml報錯cvc-complex-type.2.3: Element 'web-app' cannot have character [children], be

web.xml文件添加servlet訪問限制後出現如下錯誤:

  cvc-complex-type.2.3: Element 'web-app' cannot have character [children], because the type's content type is element-  only.

翻譯:

  cvc-complex-type.2.3:元素'web-app'不能包含character [children],因爲該類型的內容類型是僅包含元素的。

錯誤截圖如下:

解決辦法一:

  出錯原因爲xml頭文件中第三行:
  xmlns="http://java.sun.com/xml/ns/javaee"
  改成javaee改爲j2ee後解決問題。

 解決辦法二:

  由於是粘貼過來的編碼可能有問題,將xml中的文本重新手打輸入一遍,一般就會解決這種問題。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章