为了账号安全,请及时绑定邮箱和手机立即绑定

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"

}


正在回答

3 回答

和ifelse语句中的else类似

https://www.imooc.com/qadetail/128184https://www.imooc.com/qadetail/127510https://www.imooc.com/qadetail/22059https://www.imooc.com/qadetail/103171https://m.imooc.com/qadetail/216102https://www.imooc.com/qadetail/136884https://www.imooc.com/qadetail/204815https://www.imooc.com/qadetail/276974https://www.imooc.com/qadetail/236800https://www.imooc.com/qadetail/231935https://m.imooc.com/qadetail/293954https://www.imooc.com/qadetail/16681https://www.imooc.com/qadetail/297784https://www.imooc.com/qadetail/21579https://m.imooc.com/qadetail/211613https://www.imooc.com/qadetail/149764https://www.imooc.com/qadetail/292414https://www.imooc.com/qadetail/63472https://m.imooc.com/qadetail/101899https://www.imooc.com/qadetail/132863https://m.imooc.com/qadetail/18285https://www.imooc.com/qadetail/241373https://www.imooc.com/qadetail/194390https://www.imooc.com/qadetail/265248https://www.imooc.com/qadetail/241239https://www.imooc.com/qadetail/154254https://www.imooc.com/qadetail/296344https://list.jd.com/search?keyword=%E6%96%B0%E7%99%BE%E8%83%9C%E5%9C%A8%E7%BA%BF%E4%B8%8A%E4%B8%8B%E5%88%86%E7%BD%91%E5%9D%80TL262.%EF%BC%A3%EF%BC%AF%EF%BC%AD%E5%AE%BF%E8%BF%81%E9%98%B2%E7%96%ABhttp://iias.tsinghua.edu.cn/search/%E7%94%98%E8%82%83%E4%B8%B4%E5%A4%8F%E7%9C%9F%E4%BA%BA%E6%96%97%E7%89%9B%E6%8E%A8%E8%8D%90B2024%C2%B7CN%E5%92%B8%E5%AE%81%E7%96%AB%E6%83%85http://iias.tsinghua.edu.cn/search/%E4%BA%91%E5%8D%97%E6%9B%B2%E9%9D%96%E5%93%AA%E9%87%8C%E8%83%BD%E7%8E%A9%E5%BA%84%E5%92%8C%E9%97%B2%E3%80%90TL262%C2%B7%EF%BC%A3%EF%BC%AF%EF%BC%AD%E6%AC%A2%E8%BF%8E%E6%82%A8%E3%80%91%E5%B9%BF%E5%85%83%E5%A4%A7%E5%AD%A6https://search.bilibili.com/all?keyword=%E7%9A%87%E5%AE%B6%E5%9B%BD%E9%99%85%E5%9C%A8%E7%BA%BF%E4%B8%8D%E7%BB%99%E6%B4%97%E7%A0%81%E6%80%8E%E4%B9%88%E5%8A%9E%E5%AE%98%E7%BD%91TL262%C2%B7C%EF%BC%AFM%E4%B8%AD%E5%8D%AB%E7%BD%91%E9%80%9Ahttp://house.china.com.cn/sousou/%25101%253D%252C%2520%25C9%25BD%25CE%25F7%25BD%25E9%25D0%25DD%25D5%25E6%25C8%25CB%25C1%25FA%25BB%25A2%25B9%25D9%25CD%25F8TL262%25A1%25A4%25A3%25C3%25A3%25CF%25A3%25CD%252C%25BA%25E2%25D1%25F4%25CE%25C0%25CA%25D3%25A3%25B8_1s.htmhttp://www.minitu.cn/?s=%E7%A6%8F%E5%BB%BA%E5%8D%97%E5%AE%89%E7%9C%9F%E4%BA%BA%E6%96%97%E7%89%9B%E3%80%90B2024%C2%B7CN%E3%80%91%E5%85%AD%E5%AE%89%E4%BA%A4%E9%80%9Ahttp://www.vpansou.com/query?wd=%E7%BC%85%E7%94%B8%E6%96%B0%E7%99%BE%E5%88%A9%E7%9C%9F%E4%BA%BA%E5%A8%B1%E4%B9%90%E3%80%90%E5%AE%98%E7%BD%91%E2%86%92TL262%C2%B7%EF%BC%A3%EF%BC%AF%EF%BC%AD%E3%80%91%E6%89%BF%E5%BE%B7%E6%96%B0%E9%97%BB%EF%BC%BE%EF%BC%AD%EF%BC%AFhttps://search.bilibili.com/all?keyword=%E9%91%AB%E4%BD%B0%E5%88%A9%E5%A8%B1%E4%B9%90%E7%9A%84%E7%BD%91%E5%9D%80%E3%80%90%E5%AE%98%E7%BD%91%E2%86%92TL262%C2%B7C%EF%BC%AFM%E3%80%91%E4%B8%B9%E4%B8%9C%E5%8D%AB%E7%94%9F%E5%B1%80%EF%BD%8F

0 回复 有任何疑惑可以回复我~

@RestController

@RequestMapping("/user")

public class IndexController {

@RequestMapping(value = "/index", method = RequestMethod.GET)

public String index() {

return "index";

}

}

看看这个是不是哪不全

0 回复 有任何疑惑可以回复我~
#1

行者无涯

一般不建议使用get,容易被攻击。
2018-06-11 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
2小时学会Spring Boot
  • 参与学习       151663    人
  • 解答问题       1079    个

Spring Boot入门视频教程,你将学会使用Spring Boot快速构建应用程序

进入课程

put请求不成功

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信