Action EmployerAction!emplyerList cannot be found in the namespace /,同類錯誤出現在多個 redirectAction 結果中。
Struts 2.3+ 版本預設關閉 **動態方法調用**(Dynamic Method Invocation),即 ActionName!methodName 語法被禁止。
<constant name="struts.enable.DynamicMethodInvocation" value="true" /> 在 struts.xml 的 <package> 根節點或 struts.properties 中配置。<action name="EmployerAction_*" class="com.bzu.action.EmployerAction" method="{1}">
<result name="success">/jsp/admin/employerlist.jsp</result>
<result name="deletesuccess" type="redirect">EmployerAction_emplyerList</result>
</action>
URL 訪問 /EmployerAction_emplyerList.action 自動路由至 emplyerList() 方法,redirect 類型直接寫目標 Action 名稱。struts2-rest-plugin 支援 RESTful 風格映射。避免在 redirectAction 中使用 ! 語法,改用 redirect + 完整 Action 名稱,或採用通配符/REST 映射,提升安全性與可維護性。