報錯 HTTP Status 404 - /16/WebRoot/admin_index.jsp,且 `web.xml` 設定 `index.jsp`,但實際入口為 `admin_index.jsp`,導致專案根路徑無法自動導向正確頁面。
修正 web.xml
<welcome-file-list>
<welcome-file>admin_index.jsp</welcome-file> <!-- 改為實際入口頁 -->
</welcome-file-list>
完整檢查清單
- ✅ `web.xml` 中 `` `` 正確攔截 `/*` (Struts2 核心)。
- ✅ `struts.xml` `` 對應根路徑,Action 結果 `/admin_index.jsp` 路徑正確。
- ✅ 專案部署路徑:Eclipse → Server → 模組路徑應為 `/16` (而非 `/16/WebRoot`)。
- ✅ `admin_index.jsp` 實際位於 `WebContent/` 或 `webapp/` 目錄下 (非 `WEB-INF`)。
常見誤區
- 以為 404 是 Action 映射錯 → 實際是歡迎頁面配置錯,直接訪問 `https://localhost:8080/16/admin_index.jsp` 通常能通。
- Struts 2.5+ 建議用 `` 避免命名空間匹配問題。
修正 `` 後重新部署,專案根路徑即可正確導向登入頁。