put請求不成功
@PutMapping(value?=?"/personupdate/{id}")
public?Person?personupdate(@PathVariable("id")?Integer?id,
???????????????????????????@RequestParam("name")?String?name,
??????????????????????????@RequestParam("age")?Integer?age){
????Person?person?=?new?Person();
????person.setId(id);
????person.setName(name);
????person.setAge(age);
????return?personRepository.save(person);
}這是方法
報錯信息如下
{
? ? "timestamp": 1528183498443,
? ? "status": 400,
? ? "error": "Bad Request",
? ? "exception": "org.springframework.web.bind.MissingServletRequestParameterException",
? ? "message": "Required String parameter 'name' is not present",
? ? "path": "/personupdate/1"
}
2018-06-05
@RestController
@RequestMapping("/user")
public class IndexController {
@RequestMapping(value = "/index", method = RequestMethod.GET)
public String index() {
return "index";
}
}
看看這個是不是哪不全