Springmvc the information in the request is converted in a certain way and bound to the parameters of the request method, depending on the signature of the request method. SPRINGMVC also does a lot of other work during the time the request message arrives to actually call the processing method, including request information transformation, data conversion, data formatting, and data validation.
First, data binding
The core part of data binding is that the DATABINDER,SPRINGMVC framework passes the ServletRequest object and the Parameter object instance of the processing method to DataBinder, DataBinder invokes the Conversionservice component assembled in the Springweb context for data type conversion, data formatting, and populating the messages in the ServletRequest into the Parameter object. The validator component is then called to perform data validation on the parameter object that is already bound to the request message data, and eventually generates a data-bound result Bindingresult object. The Bindingresult contains a parameter object that has already completed data binding, a corresponding checksum error object, SPRINGMVC extracting the Parameter object from the Bindingresult and validating the error object, assigning them to the corresponding parameters of the processing method.
Second, data conversion
In the Java language, a propertyeditor interface is provided in the Java.beans package for data conversion. The core function of PropertyEditor is to use a string as a Java object to construct a Java object based on the interface's input or configuration string in the configuration file.
Third, the format of data
Spring uses the converter converter to convert a source type object to a target type object, and the spring converter does not assume input and output information formatting.
Four, data verification
A robust application must keep these illegal inputs out of the app and prevent some illegal input from being prevented from entering the system outside of the application, so that it can be guaranteed to be unaffected.
SPRINGMVC data conversion, formatting, and data validation