eclipse中struts2出錯

1、There is no Action mapped for namespace [/] and action name [Login] associated with context path [/eprint]錯誤

做如下檢查:

1、確保struts.xml文件名大小寫正確:struts.xml

2、確保struts.xml文件在src目錄下(很重要!後面就着重說這個)


2、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*)".錯誤

查了資料才知道,原來是package裏元素必須按照一定的順序排列:

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


3、Parse Fatal Error at line 4 column 43: 已經爲元素 "web-app" 指定屬性 "xmlns"錯誤

於是Ctrl+A全選,格式化代碼(Ctrl+Shift+F)即看到下面紅色的錯誤。原來是重複了。刪除以下紅色的代碼,重新運行,OK!其實錯誤提示的很明顯。


發佈了10 篇原創文章 · 獲贊 6 · 訪問量 8萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章