stuts.xml 配置提示警告:struts.dtd檔案找不到
阿新 • • 發佈:2019-01-03
警告地點:
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">
警告資訊:
The file cannot be validated as the XML definition "/home/zhichaoliu/workspace/.metadata/.plugins/org.eclipse.wst.internet.cache/-1087860657.cache (沒有那個檔案或目錄)" that is specified as.describing the syntax of the file cannot be located.
解決方法:
開啟struts的原始碼。在META-INF下面有struts-2.x.dtd檔案,還有struts-default.xml檔案,檢視struts-default.xml檔案的對應的版本。
操作:
我用的struts是struts2-core-2.2.3.1,struts-default.xml檔案的對應的版本是2.1.7。自己配置的struts.xml是2.0,改過來就好了。
同時還發現,在org.apache.struts2下有default.properties檔案,包含了<constant name="" value="" />中name所有的值,可以參考,不需要自己亂寫了。