1. 程式人生 > >The content of element type "package" must match 。。。。。。

The content of element type "package" must match 。。。。。。

今天寫東東的時候,在struts。xml中的 配置預設action的時候,總是有錯,報異常如下:

Caused by: The content of element type "package" must match "(result-types?,interceptors?,default-interceptor-ref?,default-action-ref?,default-class-ref?,global-results?,global-exception-mappings?,action*)". - file:/D:/Java/Apache%20Software%20Foundation/Tomcat%206.0/webapps/ejuornal/WEB-INF/classes/struts.xml:17:12
 at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:119)
 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:1009)
 ... 22 more
Caused by: org.xml.sax.SAXParseException: The content of element type "package" must match "(result-types?,interceptors?,default-interceptor-ref?,default-action-ref?,default-class-ref?,global-results?,global-exception-mappings?,action*)".
 at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)

經過多方查詢,才知道在package包中有 的配置標籤是有順序的:

 

result-types
interceptors
default-interceptor-ref
default-action-ref
default-class-ref
global-results
global-exception-mappings
action*(就是所有的action放到最後)

轉載自:https://blog.csdn.net/liyunyun6/article/details/8947675