| 1 |
No bean found under attribute key XXX |
struts-config.xml 中 ActionForm type 類不存在,或 Action name/attribute 指向不存在的 Form |
檢查類全名拼寫、Form 定義是否存在 |
| 2 |
Cannot find bean XXX in any scope |
JSP 期望取得的屬性,Action 未 setAttribute 放入 request/session/application |
檢查 JSP tag name/id 對應、Action 邏輯分支是否漏設 |
| 3 |
Missing message for key "XXX" |
ApplicationResources.properties 缺少對應資源鍵 |
補全資源檔;多模組時在 struts-config-xxx.xml 指定正確資源檔名 |
| 4 |
No getter method for property XXX of bean YYY |
JSP 讀取的 bean 屬性不存在(拼寫錯誤,如 cade vs code) |
修正 JSP tag property 值 |
| 5 |
Cannot find ActionMappings or ActionFormBeans collection |
Struts 控制器初始化失敗,通常伴隨配置檔遺失/損壞 |
檢查 struts-config.xml 是否存在、路徑正確 |
| 6 |
Cannot retrieve mapping for action XXX |
JSP html:form action="/XXX" 對應的 Action 未在 struts-config.xml 定義 |
補全 Action 映射 |
| 7 |
HTTP Status 404 - /xxx/xxx.jsp |
Forward path 指向的 JSP 不存在 |
檢查路徑、模組前綴;跨模組 forward 需 contextRelative="true" |
| 8 |
無異常,顯示空白頁 |
Action 返回的 forward 名稱與 struts-config.xml 定義不匹配 |
核對 forward 名稱大小寫 |
| 9 |
The element type "XXX" must be terminated by the matching end-tag "XXX" |
struts-config.xml XML 格式錯誤(標籤未閉合、巢狀錯誤) |
用 XML 驗證工具檢查 well-formedness |
| 10 |
Servlet.init() for servlet action threw exception |
ActionServlet 初始化拋出異常(如 NPE),堆疊指向具體行號 |
下載 Struts 原始碼對應行號斷點調試;常見原因:struts-config.xml 遺失(CVS 同步誤刪) |
| 11 |
Resources not defined for Validator |
Validator 插件驗證時,validation.xml 使用的資源未定義、form 名稱錯誤 |
檢查 validation.xml 資源引用、form name 對應 |