springMVC怎么获取前台post过来的对象

2024-12-01 07:24:07
推荐回答(1个)
回答1:

springMVC怎么获取前慧神核台post过来的对象:
@RequestMapping(value="/test",method=RequestMethod.POST)
public @ResponseBody Map testPostJson(
@RequestBody UserForm userForm,
BindingResult bindingResult) {

Map<前掘String, Object> map = new HashMap();
if (bindingResult.hasErrors()) {
map.put("errorCode", "40001"瞎颤);
map.put("errorMsg", bindingResult.getFieldError().getDefaultMessage());
}

map.put("user", userForm);
return map;
}