1、context-type
(1) get requests
splicing parameters can directly get request in the address
get request can get directly @RequestParam
(2) post request
Reception data format
var jsonParam = {id:id,name:name}
context-type:application/json
method: 'post'
Background receiver (note, @ RequestBody only be used in post request)
用 @RequestBody 就可获得封装的实体
So you get the object information coming from the front desk, but sometimes want to get the individual attribute values from json object is delivered in the foreground, the package did not want to target, how to do it?
Reception data
var jsonParam = {id:id, name: name}
context-type: application/x-www-form-urlencoded
method: post
Background reception
public String find(@RequestParam(name="id") String id){}
Json default foreground in the background have been encapsulated into objects, direct access to the parameter is not taken,
Context-type needs to be changed to x-www-form-urlencoded
Encoding format sent to the server object to do so will jsonParam client object to a key / value format
You will be able to get through @RequestParam