1. Data type, you can bind basic data types, such as int age, or packaging types such as: Integer age;
The difference between the two: when the type is int, this parameter is required, and the Integer can be empty.
2. Bind the array
,
3. Bind the object.
3. Binding of multiple objects with the same attribute, first InitBinder to bind the object
, after binding it,
When accessing object properties, use object.property, without adding "object.", the default is that the property values of both objects are the filled properties, for example:
4. Bind the List collection, create an object,
Rebind:
5. Bind the Set collection:
Create an object first
, and then bind , Set collection application scenario: used to remove duplication, such as: when filling in the information, a User wrote two copies of the same information, so how to prevent the same data from duplication? At this time, you need to rewrite and change the User Object's hashCode and equals methods
6.Map binding: Similar to List binding, first create an object
When binding it:
7. Json data binding
Dependent packages
8.xml data binding:
Dependent packages:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>4.0.0.RELEASE</version>
</dependency>