@RequestMapping(value = "/{id}",method = RequestMethod.PUT)
public String updateAccount(@PathVariable("id") int id, @RequestParam(value = "mame",required = true)String name,
@RequestParam(value = "money",required = true)double money){
Account account=new Account();
account.setMoney(money);
account.setName(name);
account.setId(id);
int t=accountService.update(account);
if (t==1){
return account.toString();
}else {
return "fail";
}
}
我用测试工具通不过 可能是@PathVariable和@RequestParam的问题
{
"timestamp": 1502334349157,
"status": 400,
"error": "Bad Request",
"exception": "org.springframework.web.bind.MissingServletRequestParameterException",
"message": "Required String parameter 'mame' is not present",
"path": "/account/3"
}
这个是测试工具的反馈