標籤:struts1 架構
1.Action類的execute()方法:
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException ;
2.Action類的execute()方法的參數和返回值:
– execute()方法包含以下參數:
–ActionMapping:包含了這個Action的配置資訊,和strutsconfig.xml檔案中的<action>元素對應。
–ActionForm:包含了使用者的表單資料,當Struts架構調用
execute()方法時,ActionForm中的資料已經通過了表單驗證。
–HttpServletRequest:當前的HTTP請求對象
–HttpServletResponse:當前的HTTP響應對象
–Action類的execute()方法返回ActionForward對象,它包含了請求轉寄路徑資訊。
3.內建的Struts Action類:
–org.apache.struts.actions.ForwardAction
–org.apache.struts.actions.IncludeAction
–org.apache.struts.actions.DispatchAction
–org.apache.struts.actions.LookupDispatchAction
–org.apache.struts.actions.SwitchAction。
4.模型代表應用的業務資料和商務邏輯。Struts作為一個WEB架構並沒有為建立模型組件提供現成的
架構。但是Struts允許使用其它模型架構來處理應用的商務邏輯。比如:EJB、JDO、JavaBean、
ORM、Spring等。
第五課 Struts的控制器【續】Action類的execute()方法