
Paste_Image.png

Paste_Image.png
注:存在多個匹配的情況:絕對匹配 ->按照通配符匹配的配置順序為準
動態(tài)方法調用DMI(Dynamic Method Invocation)
<!-- 動態(tài)方法調用:沒有指定訪問動作方法 -->
<action name="addCustomer" class="com.pangu.action.CustomerAction" />
在訪問時需要指定執(zhí)行的動作方法
http://localhost:8080/Struts2Demo/addCustomer!add // 執(zhí)行addCustomer動作對應動作類的add動作方法
默認的情況下:會報錯,說找不到addCustomer!add這個動作方法,因為Struts2框架默認情況下是禁止動態(tài)方法調用的。
<!-- 允許動態(tài)方法調用:開發(fā)中不建議使用容易暴露動作類中的動態(tài)方法,害怕非法執(zhí)行 -->
<constant name="struts.enable.DynamicMethodInvocation" value="true"></constant>