(个人经验,仅供参考,错误之处,敬请谅解)
问题
在加载项目的时候,一直提示struts.xml 文件错误,错误提示:
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*)”.
搜索之后,基本都在解释顺序问题,个人反复比对顺序,并结合其他项目配置文件,也不断保存调试仍然提示错误。
(下列为正常配置顺序)
result-types
interceptors
default-interceptor-ref
default-action-ref
default-class-ref
global-results
global-exception-mappings
action*
结果
实际最后尝试发现,不同的配置之间,有的不能存在空格(换行)。
个人在global-results 之下有换行,再接着所有的action,才会一直报错。当global-results紧跟着action则不会报错。