eclipse 未验证 struts.xml 文件
eclipse not validating the struts.xml file
我在新 p.c 中安装了 eclipse。并在其中导入我的 struts2 旧项目,在导入项目后,我在 struts.xml 文件中收到警告,即 "The file cannot be validated as there was a connection problem."。我替换了我的 jar 文件和 doctype 很多次,但仍然没有用。我还发现如果我在那个文件中做错了什么,eclipse 不会向我显示任何错误,即使 eclipse 清理我的项目需要很多时间来清理 struts.xml file
<?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">
<struts>
<package name="a" extends="struts-default">
<action name="b" class="com.test">
<result name="success">/success.jsp</result>
<result name="error">/error.jsp</result>
</action>
</package>
</struts>
请帮助我,我遇到了很多困难...???
将文档类型更改为:
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
"/WEB-INF/dtds/struts-2.1.dtd">
并将 "struts-2.1.dtd" 文件从 "struts2-core-2.1.8.1.jar" 提取到 WEB-INF 文件夹内的 dtds 文件夹(新建)。
当 eclipse 无法打开文件时会发生这种情况,当我遇到 Internet 连接问题时有时会发生这种情况。
因此请确保您有互联网连接并且您没有设置任何无法正常工作的代理并阻止 eclipse 访问互联网。您可以打开 struts.xml 并 ctl+单击 http://struts.apache.org/dtds/struts-2.3.dtd
如果你的问题还没有解决,你可以按照@AsSide说的那样,将struts-2.3.dtd复制到你硬盘的某个地方,然后将struts.xml改成以下:
<!DOCTYPE struts SYSTEM "c://struts-2.3.dtd">
必须将 DOCTYPE 更改为 SYSTEM
而不是 PUBLIC
。更改 dtd 位置不是一个好方法:)
我在新 p.c 中安装了 eclipse。并在其中导入我的 struts2 旧项目,在导入项目后,我在 struts.xml 文件中收到警告,即 "The file cannot be validated as there was a connection problem."。我替换了我的 jar 文件和 doctype 很多次,但仍然没有用。我还发现如果我在那个文件中做错了什么,eclipse 不会向我显示任何错误,即使 eclipse 清理我的项目需要很多时间来清理 struts.xml file
<?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">
<struts>
<package name="a" extends="struts-default">
<action name="b" class="com.test">
<result name="success">/success.jsp</result>
<result name="error">/error.jsp</result>
</action>
</package>
</struts>
请帮助我,我遇到了很多困难...???
将文档类型更改为:
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
"/WEB-INF/dtds/struts-2.1.dtd">
并将 "struts-2.1.dtd" 文件从 "struts2-core-2.1.8.1.jar" 提取到 WEB-INF 文件夹内的 dtds 文件夹(新建)。
当 eclipse 无法打开文件时会发生这种情况,当我遇到 Internet 连接问题时有时会发生这种情况。
因此请确保您有互联网连接并且您没有设置任何无法正常工作的代理并阻止 eclipse 访问互联网。您可以打开 struts.xml 并 ctl+单击 http://struts.apache.org/dtds/struts-2.3.dtd
如果你的问题还没有解决,你可以按照@AsSide说的那样,将struts-2.3.dtd复制到你硬盘的某个地方,然后将struts.xml改成以下:
<!DOCTYPE struts SYSTEM "c://struts-2.3.dtd">
必须将 DOCTYPE 更改为 SYSTEM
而不是 PUBLIC
。更改 dtd 位置不是一个好方法:)