java – 由于servlet文件导致的xml错误无法找到元素的声明,Refer
发布时间:2020-12-15 05:01:01 所属栏目:Java 来源:网络整理
导读:我不知道为什么会发生这些错误有人可以解释我如何解决它们 – cvc-elt.1:找不到元素’web_1:web-app’的声明. 引用文件包含错误(jar:file:/ C:/ Program Files / eclipse / plugins / org.eclipse.jst.standard.schemas_1.2.0.v201101142102.jar!/dtds
我不知道为什么会发生这些错误有人可以解释我如何解决它们 –
> cvc-elt.1:找不到元素’web_1:web-app’的声明. 这是我面临的两个错误,因为我错误地添加了一个servlet,我打算将一个普通的类文件添加到我的项目中. 仍然是xml文件 – <?xml version="1.0" encoding="UTF-8"?> <web_1:web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_4.xsd" xmlns:web_1="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> <display-name>InitialD</display-name> <web_1:welcome-file-list> <web_1:welcome-file>index.html</web_1:welcome-file> <web_1:welcome-file>index.htm</web_1:welcome-file> <web_1:welcome-file>index.jsp</web_1:welcome-file> <web_1:welcome-file>default.html</web_1:welcome-file> <web_1:welcome-file>default.htm</web_1:welcome-file> <web_1:welcome-file>default.jsp</web_1:welcome-file> </web_1:welcome-file-list> </web_1:web-app> 解决方法
正如Mark和Saurabh所说,从web.xml文件中删除“web_1:”的每个实例都是可行的.同时,最好删除对模式“xmlns:web_1”的引用.一个基于Saurabh问题的可行片段如下:
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_4.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> <display-name>InitialD</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> </web-app> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |