天天看點

Struts2中There is no Action mapped for namespace / and action name異常

關于這個異常,網上貼出了很多種原因,而我又發現了一種新的原因,貼出供大家參考~

因為項目較大,每次運作都重新build project比較麻煩,是以就在eclipse中吧build automatically給關了,而我在運作struts項目時,也不是右鍵“run on server”,而是直接在server

視圖中添加了struts項目,然後啟動server,這就導緻項目其實并沒有build,而/WebContent/WEB-INF/classes檔案夾也為空,是以就彙報There is no Action mapped for

namespace / and action name異常,手工build一下project就好了(右鍵項目,build project)~

哎,小小錯誤,被坑了幾個小時~

PS:struts.xml檔案中有時會報如下錯誤,可能是你沒有聯網的緣故

Multiple annotations found at this line:    

- Package extends undefined package struts-default    

- Empty or undefined Package name    

- Attribute "name" is required and must be specified for element type       "package".

繼續閱讀