struts1.x基本action的配置與使用
<!--
struts1.x的action配置都很簡單,
繼承自Action的自定義Action配置如下,
當要進生輸入校驗時必設置validate爲true,
input 指定驗證出錯後要返回的頁面
-->
<action path="/register" type="edu.yzu.action.UserAction"
input="/register.jsp" validate="true" name="userForm">
<forward name="success" path="/result.jsp"></forward>
</action>
<!--
繼承自MappingDispatcherAction,多了一個parameter屬性,
此屬性指定本此請求調用此action中的哪個方法。
-->
<action path="/updateorder" type="edu.yzu.action.OrderAction"
parameter="updateOrder">
<forward name="success" path="/result.jsp"></forward>
</action>
<!--
繼承自DispatcherAction跟繼承自MappingDispatcherAction配置相同,不過
parameter的含義不同,它後面指定的值要在請求此action的url後面加上,如一個刪除訂單的請求應該爲
http://localhost/shopcart/deleteorder.do?method=deleteOrder 其中method後面的值爲要調用action
的方法名。
-->
<action path="/deleteorder" type="edu.yzu.action.OrderAction"
parameter="method">
<forward name="success" path="/result.jsp"></forward>
</action>
<!--
LookupDispatcherAction與DispatcherAction的配置相同,但是含義不同
它的parameter指的是頁面按提交按鈕的name值。並且按鍵的value必須要有資源文件的支持,且在其action中
指定這個值與action內的方法的對應關係。很麻煩,由此可見這個LookupDispatcherAction實在不常用!
-->
<action path="/usermanage" type="edu.yzu.action.UserLookupAction" parameter="callmethod">
<forward name="success" path="/ok.jsp"></forward>
</action>