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中的文本重新手打輸入一遍,一般就會解決這種問題。