Home > Back-end >  SrpingBoot receive ajax data when the data type
SrpingBoot receive ajax data when the data type

Time:04-20



Pictured above, if the Object to receive front-end data, can be received, but if use entity class receive data, in addition to the hrid fields, all is null, the interfaces and my other basic same, but only this interface problems, solving!!!!! Urgent
First, every brother thanked

CodePudding user response:

@ RequestBody annotations need to front the json string come
@ RequestParam can be put into the from the form or the stitching on the link

CodePudding user response:


/* *
The curl -h "content-type: application/json" - X POST -- data '{
"Id" : "1111111",
"Name" : "hello"
} '
http://localhost:8080/demo/printProduct
* @ param product
*/
@ PostMapping ("/printProduct ")
Public void printProduct (@ RequestBody Product Product) {
The info (product. The toString ());
}
  • Related