1.客戶端(client)向伺服器傳送乙個請求(request)。
2.容器(container)通過web.xml對映請求,並獲得控制器(controller)的名字。
3.容器(container)呼叫控制項器(strutsprepareandexecutefilter或filterdispatcher)。
--struts2.1以前呼叫filterdispatcher。
--struts2.1之後呼叫strutsprepareandexecutefilter。
5.控制器(controller)呼叫 actionproxy。
6.actionproxy讀取struts.xml檔案讀取相應的action和interceptor stack的資訊。
7.actionproxy把request請求傳遞給actioninvocation。
8.actioninvocation依次呼叫action和interceptor。
9.根據action執行結果,產生result。
10.result資訊返回到actioninvocation。
11.產生乙個httpservletresponse響應,並返回給客戶端。
Struts2 工作原理
1 客戶端初始化乙個指向servlet容器 例如tomcat 的請求 2 這個請求經過一系列的過濾器 filter 這些過濾器中有乙個叫做actioncontextcleanup的可選過濾器,這個過濾器對於struts2和其他框架的整合很有幫助,例如 sitemesh plugin 5 action...
struts2 工作原理
struts2並不是乙個陌生的web框架,它是以webwork的設計思想為核心,吸收struts1的優點,可以說 struts2是struts1和webwork結合的產物。struts2 的工作原理圖 乙個請求在struts2框架中的處理分為以下幾個步驟 1.客戶端發出乙個指向servlet容器的請...
struts2工作原理
struts2工作原理 程式設計原理 使用者傳送http請求 web伺服器 tomcat 載入web.xml web部署描述檔案 檔案 執行struts核心控制器 strutsprepareandexecutefilter或者filterdispatcher 載入struts.xml檔案,通過請求a...