SPRINGMVC Data binding process

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.