ActionMapping、ActionForward筆記

來源:互聯網
上載者:User

最近學了ActionForward和ActionMapping類,在這裡的一點瞭解給大家分享一下。

ActionMapping:每一個Action元素都與類ActionMapping的一個執行個體對應,包括name、path、Forwards

配置資訊如下:

 

代碼

    <action-mappings>
           <action path="/login" type="login.LoginAction" name="loginForm">
               <forward name="loginSuccess" path="/loginSuccess.jsp"></forward>
               <forward name="loginFailure" path="/loginFailure.jsp"></forward>
           </action>
       </action-mappings>

 <action-mapping>:協助進行架構內部的流程式控制制,可將請求URI映射到Action類,將Action對象與ActionForm對象相關聯。<Action-mapping>元素內可定義多個<action>子項目。

---------------------------------------------------------------------------------------------------------------

ActionForward:他的對象是設定物件,該對象封裝了向前進的URL路徑且將要求處理常式用於識別目標視圖。相關屬性有name,path,Redirect,各包含的意思:

name:邏輯名

path:頁面或模組訪問路徑

Redirect:如果為false或者no,則執行RequestDispatcher.forward(path路徑相對當前應用);如果為true或者yes,執行HttpServletResponse.sendirect(為true表容器外跳轉)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.