Data binding Process
SPRINGMVC The main framework passes the ServletRequest and the target method into the Webdatabinderfactory instance to create the DataBinder instance object.
Second, DataBinder calls assembly in the SPRINGMVC context of the Conversionservice for data type conversion, data formatting work. Populates the request information in the servlet into the incoming parameter object.
Third, call the validator component to verify the legitimacy of the data that is already bound to the incoming parameter object of the request message, and generate the final data-bound result BindingData object.
SPRINGMVC extracts the Bindinresult and checksum error objects, and assigns them to the response parameters of the processing method.
//code in the Org.springframework.web.method.annotation.ModelAttributeMethodProcessorWebdatabinder Binder=Binderfactory.createbinder (WebRequest, attribute, name); if(Binder.gettarget ()! =NULL) { if(!mavcontainer.isbindingdisabled (name)) {bindrequestparameters (binder, webRequest);//This line of code makes the request parameter binding, and executing this line of code invokes the type converter. } validateifapplicable (binder, parameter);//This line of code for data validation if(Binder.getbindingresult (). HasErrors () &&isbindexceptionrequired (binder, parameter)) { Throw Newbindexception (Binder.getbindingresult ()); } }
SPRINGMVC Data binding process