[Vuejs]-How to Spring mvc receives the axios array?

0👍

✅

It should be like this

@RequestMapping(value = "brand/{ids}",method = RequestMethod.GET)
@ResponseBody
public Object deleteByIds(@PathVariable Integer[] ids) {
 System.out.println(ids);
 goodsBrandService.deleteByIds(ids);
 JSONObject jsonObject = new JSONObject();
 jsonObject.put("msg","success to delete");
 return jsonObject;
}

I think it should be like this:

@RequestMapping(value = "brand",method = RequestMethod.GET)
@ResponseBody
public Object deleteByIds(@RequestParam(value="ids[]") Integer[] ids) {

}

But I recommend to use POST method instead GET, so your request mapping changes to this:

@RequestMapping(value = "brand",method = RequestMethod.POST)
@ResponseBody
public Object deleteByIds(@RequestBody WarapperList ids) {

}

and WrapperList is a class like this:

class WrapperList{
    private List<Integer> ids;
} 

Leave a comment