<?xml version="1.0" encoding="UTF-8"?>编译 报错

J2EE 码拜 9年前 (2015-04-21) 6454次浏览 0个评论
 

新建一个动态web项目,web.xml的第一行报错,但是好像不影响程序运行

<?xml version=”1.0″ encoding=”UTF-8″?>

错误内容如下:
The errors below were detected when validating the file “javaee_6.xsd” via the file “web.xml”.  In most cases these errors can be detected by validating “javaee_6.xsd” directly.  However it is possible that errors will only occur when javaee_6.xsd is validated in the context of web.xml.

<?xml version="1.0" encoding="UTF-8"?>编译 报错
20分
web.xml 是用eclipse自动生成的吗?还是自己从别的地方拷贝修改的,重点是javaee_6.xsd 哪里来的?
<?xml version="1.0" encoding="UTF-8"?>编译 报错
报错的文件

<?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" 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>aa</display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    
  </welcome-file-list>
</web-app>

第二行改成下面的样子就不报错了

<?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_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>0001</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>

下面正确的文件是Version: Juno Release的eclipse自动生成的
上面报错的是Release2

<?xml version="1.0" encoding="UTF-8"?>编译 报错
但是不清楚为什么,请指教

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明<?xml version="1.0" encoding="UTF-8"?>编译 报错
喜欢 (1)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!