天天看點

struts2配置檔案錯誤(The content of element type “package” must match**)

今天在對struts2的做一些預設配置,當想增加一個預設的action時,出現了錯誤

錯誤提示是:

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*(就是所有的action放到最後)

原來我把default-action-ref放在了其他的節點之後了,調整位置之後,錯誤消失了

繼續閱讀