struts 調用流程

來源:互聯網
上載者:User

簡單的給struts的調用流程做一個歸納

1:Servlet 容器接收到一個請求以後,通過請求交給web.xml中配置的FilterDispatcher.調用它的doFilter() 方法

2 :FilterDispatcher詢問actionMapper.查看是否有對應的action

3:FilterDispatcher調用Dispatcher類的serviceAction方法

4Dispatcher類調用execute 方法的時候,先看一下mapper裡面返回的result是否為空白,如果為空白則執行execute

5如果mapper中的result如果不為空白則通過actionproxy 設定actionInvocation對象的執行內容。調用其invoke()

6actionInvocation 的invoke方法從攔截器中尋找尚未執行的攔截器,調用intercept(invocation )

7如果攔截器都執行通過了,就調用action執行個體的execute方法。通過struts.xml找對應的方法

8actionInvocation通過action返回對應的記過,然後尋找到對應的result,result通過execute(invocation)將結果給使用者

聯繫我們

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