1:@RequestParam
Action: it specifies the name of the parameter in the request to the controller parameter assignment
Properties: required: if the request parameter must provide this parameter. Default values: true, expressed the need to provide the conditions, otherwise an error instead false, no error
When the value is not received without error, it will be displayed null
2:@RequestBody
Role: an acquisition request for the content thereof. It is obtained directly using the key = value & key
Data structures = value ..
get request NA
Properties: required: Must have a request body, the default value true when the value is true, get request method will complain. If the value is false, get request is null.
3:3.@ResponseBody
effect
The method used
When the return type of the return json time, but also with this comment, he can help json package data, this time behind the return was encapsulated, then return will not be understood as the jump page view resolver.
4:@RequestHeader
Action: a request message for acquiring the header
Attributes:
value: providing a message header name
required: Do you have to have this header
note:
In the actual development generally do not
5: @CookieValue
Role: The value of the cookie is used to specify the name of the incoming method parameters Controller
Attributes
value: Specifies the Cookie
required: Do you have to have this cookie
6: @ModelAttribute
Role: The form is then SpringMVC4.3 version of the new party. He can be used to modify the methods and parameters.
In the method appears on representing the current method will be executed before control method, performed first. His method does not return value can be modified, specific methods can also be modified.
Appears on the parameters, gets the specified data to the parameter assignment
Attributes:
value: used to obtain key data. may be a key attribute name POST may also Map key structure,
Scenario:
To ensure that no data submitted to the database fields using original data of the target when submitting incomplete data entity class data forms,
E.g:
When we edit a user, a user has created an information field, the field's value is allowed to be modified. In submitting the form data is certainly not the contents of this field, once with the new content of the field will be set to null, then you can use this annotation to solve the problem.
7:SessionAttribute
Role: an inter-controller repeatedly parameter sharing method
Attributes:
value: for property specifies the name of deposit
type: used to specify the type of data stored