Eclipse 在eclispe中创建动态web项目时web.xml中出错

Eclipse 在eclispe中创建动态web项目时web.xml中出错,eclipse,Eclipse,我正在尝试使用eclipse创建一个新的web项目 文件->新建->动态web项目 下一步完成 这里是web.xml 它向我显示了以下错误 cvc elt.1.a:找不到元素“web app”的声明。(如果我选择2.5动态web模块版本) 下载时出错'http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd“对C: \Users\yg178f.lsp4xml\cache\http\java.sun.com\xml\ns\javaee\web-app_3_

我正在尝试使用eclipse创建一个新的web项目

文件->新建->动态web项目

下一步完成

这里是web.xml

它向我显示了以下错误

cvc elt.1.a:找不到元素“web app”的声明。(如果我选择2.5动态web模块版本)

下载时出错'http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd“对C: \Users\yg178f.lsp4xml\cache\http\java.sun.com\xml\ns\javaee\web-app_3_0.xsd。(如果我选择3.0动态web模块版本)

这是我的web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <display-name>Struts2Demo</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>

Struts2Demo
index.html
index.htm
index.jsp
default.html
default.htm
default.jsp

我从web.xml中获取了这个
web.xml,并通过删除所有URL解决了这些问题:

  <?xml version="1.0" encoding="UTF-8"?> 
    <web-app> 
      <filter> 
      <filter-name>struts2</filter-name> 
       <filter-class> 
        org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter 
       </filter-class> 
      </filter> 
      <filter-mapping> 
       <filter-name>struts2</filter-name> 
        <url-pattern>/*</url-pattern> 
      </filter-mapping> 
    </web-app>

支柱2
org.apache.struts2.dispatcher.ng.filter.strutspreadexecutefilter
支柱2
/* 

Hi,我收到了同样的错误。你找到解决办法了吗?谢谢。我记不清了,但我记得的是,我下载了XSD并将其保存在WEB-INF中,我没有给出URL,而是给出了路径XSD(尽管是相对路径),这就解决了我当时的问题。我已经有一段时间面对这个问题了,所以我不确定这是否是我当时得到的确切解决方案。我也在这里发布了同样的问题: