The ContentType default value set when Ajax passes JSON is application/x-www-form-urlencoded,
When Ajax passes JSON, the ContentType set when it is Application/json or Text/json, in Java, Request.getparameter ("") is not receiving data.
Because in the Java background will think you pass a plain text stream, but not the key value pair, cannot deposit requestmap.
You can read the stream and turn it into JSON to convert to lsit or objects, and use @requestbody annotations in spring.
In a SPRINGMVC environment, @RequestBody receives a string of JSON objects instead of a JSON object. In AJAX requests, however, the JSON object is often passed, and the object can be converted to a string using the Json.stringify (data) method. At the same time the AJAX request also specify datatype: "JSON", ContentType: "Application/json" so you can easily upload an object or list to Java side ...
Reprint: https://www.cnblogs.com/fenglie/articles/5127969.html
The contenttype set when Ajax passes JSON causes Request.getparameter ("") in Java to receive no data