错误:Referenced file contains errors (http://struts.apache.org/dtds/struts-2.3.dtd). For more information, right click on the message in the Problems View and select "Show Details..."
解决方法(两种):
1. 这个可能是你的DTD文件找不到,或者解析有错,才发生的错误.你可以在地址栏里输入http://struts.apache.org/dtds/struts-2.3 .dtd 这个看能查看不,如果不能,应该是网络的问题或XML解析的问题,解决的方法就是你把DTD文件拷贝到你的CLASSPATH目录下,把http://struts.apache.org/dtds/struts-2.3 .dtd 这个路径换成"/WEB-INF/classes/struts-2.3 .dtd "这样再试一下
2. 从struts2-core-2.x.x.jar中取出struts-2.3.dtd,打开[Window]-[Properties],打开对话框.在左边的树形列表中选择[MyEclipse]-[Files-Editors]-[XML]-[XML Catalog],此时右边显示相应的内容.在右边[XML Catalog Entries]下方有一个[Add]按钮,单击它,在弹出的对话框中输入:
Location:UseStruts2/src/struts 2.3.dtd(这个选择你刚取出来的 struts-2.3.dtd文件)
Key Type:Public ID
Key:-//Apache Software Foundation//DTD Struts Configuration 2.3//EN
选择[OK]即可添加.
3.可能是版本问题(最常见):
看了一下,我的struts是2.3,然后修改了struts.xml对dtd的引用
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd">
在修改时我采用的是此种方法,打开Referenced Libraries,里面有struts2-core-2.x.x.jar包,可以看到多个Struts-2.x.dtd文件,那么就可以按照这几个文件在struts.xml的版本处修改。
改为:<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">
当然了,如果错误是2.0.dtd,那么就试着改为2.1.dtd或者2.3.dtd
---------------------
作者:安心Smile
来源:CSDN
原文:https://blog.csdn.net/ANXIN997483092/article/details/72621858
版权声明:本文为博主原创文章,转载请附上博文链接!
|
|