get
PUTid...
get
PUTid...
the parameters of your post
are not in json
format, but postman
all give you an error.
try the following one
if you accept the three id,name,age fields in the object, your parameters should be the following, right? Key is the parameter name, according to the way you wrote it above, the parameter name is user, isn't it?
{
"name":"aa",
"id":1,
"age":55
}
No postman, installed
var data="{\"id\":\"1\",\"age\":22,\"name\":\"aa\"}";
$.ajax({
type:'post',
url:url,
data:data,
contentType:"application/json;charset=utf-8",
success:function(msg){
}
});
(@RequestBody User user)
put aside the meaning of this annotation of @ modelattribute.
the parameters of the get request can be placed in the header and can be received. If it is a post request and the parameter is in the format of json and placed in body, it is recommended to accept it with @ requstBody in the method.
the difference between these two items is mainly based on how your front end passes the value and how the back end receives it. Generally divided into restful style, and header and front-end transmission of json-based form, so that the background can receive the front-end information to do processing.
in the backend code, the format (., User parameter name of the request parameter) so this is a formdata request, so the parameter should be passed in form-data format instead of raw (JSON) in Postman. Different from the request parameter (@ RequestBody User parameter name)
Previous: Different versions of PHP generate canvas BUG
Next: After webpack was packaged, Wechat opened the page on ios and reported an error about manifest.
I use the java program request interface encapsulated by okhttp to return a message of type key. I use the same input parameter to get the message returned by the postman request, and this key is of type JSONarray. The postman returned is correct. How d...
problem description the post method calls the remote interface, and postman succeeds, but it fails to use httpclient request through java code. the server cannot debug and does not know its own error A server error occurred.. Please contact the admin...