第五課 Struts的控制器【續】Action類的execute()方法

來源:互聯網
上載者:User

標籤: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()方法

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.