2009年12月11日 星期五

structs-config-xml-version

配置structs-config.xml 時, 一旦加上了 元素, 便會出錯

訊息類似:

Parse Error at line 15 column 68: Element type ”plug-in” must be declared.

….

org.xml.sax.SAXParseException: The content of element type ”struts-config” must match ”(data-soures?,form-beans?,global-forwards?,action-mappings?)”.

….

其實這主要是版本的問題.


正是你声明了才会报错,首先说这个错误的问题,因为你的配置文件头用的

所 以使用的是struts1.0的配置文件格式,你可以从http://jakarta.apache.org/struts/dtds/struts- config_1_0.dtd下载这个DTD看看里面不包含messeage-resources和plug-in的元素定义,另外从错误提示中也可以看 出来
org.xml.sax.SAXParseException: The content of element type ”struts-config” must match ”(data-soures?,form-beans?,global-forwards?,action-mappings?)”.

解决办法一是去掉那两个元素,二是文档定义用比struts1.0更高版本的,例如

这个是struts1.2的,但也要保证你用的struts包也是1.2的

資料來源: http://www.javaresearch.org/forum/thread.jsp?column=20&thread=36528

沒有留言: