Home > Back-end >  Using the vue axios send a get request and carry objects, Java background how to receive parameters
Using the vue axios send a get request and carry objects, Java background how to receive parameters

Time:01-01

Using the vue axios send a get request and carry objects, Java background how to receive parameters,
 
Let data={
https://bbs.csdn.net/topics/Brand: {
Name: 'asus'
Letter: 'H',
},
Cids: [1, 2]
}

Let {data: res}=await this. $axios. Get (" item/brand/save ", {params: data})

CodePudding user response:

Built as an attribute class and then use the @ ResponseBody

CodePudding user response:

In accordance with your method tried, POST request is no problem, but GET or not

CodePudding user response:

reference 1st floor is zhao dare to dare to reply:
built as an attribute class and then use the @ ResponseBody
in accordance with your method tried, POST request is no problem, but GET or not

CodePudding user response:

Correct, write wrong, should be a @ RequestBody @ GetMapping can only use the @ RequestParam can't use the @ RequestBody, if is a get request directly write entity class went, he will be automatically mapped to entity class
 
Class A {}
@ GetMapping ("/test ")
Public Result getTest (A) A {

}

@ PostMapping ("/test ")
Public Result postTest (@ RequestBody A A) {
}
  • Related