java web项目中于struts.xml总是报个红叉叉,控制台报错:Description Resource Path Location Type Referenced file contains

java web项目中于struts.xml总是报个红叉叉,控制台报错:Description Resource Path Location Type
Referenced file contains errors (http://struts.apache.org/dtds/struts-2.0.dtd).For more information, right click on the message in the Problems View and select "Show Details..." struts.xml  /tips/src line 1 XML Problem的解决办法:
http://struts.apache.org/dtds/struts-2.0.dtd可以先试试这个网站能不能打开,若不能就是网络的问题(网上找不到,所以报错)或XML解析的问题
解决办法:
直接把我下面的struts-2.0.dtd文件内容复制一份放在项目的src文件夹下,取名struts-2.0.dtd,然后把struts.xml中的"http://struts.apache.org/dtds/struts-2.0.dtd"改为"/WEB-


INF/classes/struts-2.0.dtd"保存即可.


struts-2.0.dtd的内容是通过java反编译工具如jd-gui.exe把struts2-core-***.jar这个jar包打开,找到struts-2.0.dtd文件


struts-2.0.dtd文件内容如下:












    name CDATA #REQUIRED
    extends CDATA #IMPLIED
    namespace CDATA #IMPLIED
    abstract CDATA #IMPLIED
    externalReferenceResolver NMTOKEN #IMPLIED
>






    name CDATA #REQUIRED
    class CDATA #REQUIRED
    default (true|false) "false"
>






    name CDATA #REQUIRED
    class CDATA #REQUIRED
>



    name CDATA #REQUIRED
>



    name CDATA #REQUIRED
>



    name CDATA #REQUIRED
>



    name CDATA #REQUIRED
>



    class CDATA #REQUIRED
>









    name CDATA #REQUIRED
    class CDATA #IMPLIED
    method CDATA #IMPLIED
    converter CDATA #IMPLIED
>



    name CDATA #REQUIRED
>



    name CDATA #IMPLIED
    type CDATA #IMPLIED
>



    name CDATA #IMPLIED
    exception CDATA #REQUIRED
    result CDATA #REQUIRED
>



    file CDATA #REQUIRED
>



    type CDATA #IMPLIED
    name CDATA #IMPLIED
    class CDATA #REQUIRED
    scope CDATA #IMPLIED
    static CDATA #IMPLIED
    optional CDATA #IMPLIED
>



    name CDATA #REQUIRED
    value CDATA #REQUIRED    
>




你可能感兴趣的:(java,web)