Required String parameter 'xxxx' is not present

ajax请求spring后台出现 Required String parameter ‘id’ is not present异常,
1.如果前端传入的是json数据那么后端使用
@RequestBody HashMap<String, String> map
进行接收,然后再通过map.get(“id”)获取对应的数据
2.如果前端传入的是正常表单数据,那么后端使用
@RequestParam("id") String id或者
@RequestParam(value="id", required = false) String id接收参数

猜你喜欢

转载自blog.51cto.com/1929297/2548743