1)所有請求過來,dispatcherservlet收到請求
2)呼叫dodispatch()方法進行處理
protected
//4、gethandleradapter()拿到能夠執行這個類的所有方法的介面卡(反射工具annotationmethodhandleradapter能解析註解方法的介面卡)
handleradapter ha =
this
.gethandleradapter
gethandler()
);//5、獲取請求方式:post、get等
string method = request.
getmethod()
;boolean isget =
"get"
.equals
(method);if
(isget ||
"head"
.equals
(method))if
((newservletwebrequest
(request, response)).
checknotmodified
(lastmodified)
&& isget)}if
((processedrequest, response)
)//6.用介面卡執行目標方法,方法返回值作為檢視名,設定儲存到modelandview中
//目標方法無論怎麼寫,最終介面卡執行完成後都會將執行完成的結果封裝成modelandview
mv = ha.
handle
gethandler()
);if(asyncmanager.
isconcurrenthandlingstarted()
)this
.(processedrequest, mv)
;(processedrequest, response, mv);}
catch
(exception var20)
catch
(throwable var21)
//7.根據方法最終執行完後的封裝的modelandview:**到對應頁面,而且modelandview中的資料可以在請求域中獲取
this
.processdispatchresult
(exception)dispatchexception);}
catch
(exception var22)
catch
(throwable var23)
finally
}else
if(multipartrequestparsed)
}}
SpringMVC 三 處理請求資料
1.form元件 action屬性表示提交位址 method屬性表示提交方式 表單內容可以有 input textarea button select option optgroup fieldset label 等標籤 2.傳遞字面量引數 1 在處理請求的方法中,加入相對應的形參,保證形參的名字 ...
SpringMvc原始碼(二) 處理請求過程
過程 1.請求首先進入到frameworkservlet的processrequest中。2.呼叫dispatcherservlet中的doservice方法,對請求進行預設定,doservice方法在frameworkservlet為抽象方法。3.最後呼叫dispatcherservlet的dod...
SpringMVC 如何將請求找到匹配的處理方法
在springmvc的模式下,瀏覽器的乙個請求是如何對映到指定的controller的呢?在web伺服器啟動時,spring容器中會儲存乙個map的資料結構,裡邊記錄這controller和url請求中的對應關係。那麼這個map中的資料是如何來的呢?protected void inithandle...