課程
/后端開發
/Java
/2小時學會Spring Boot
不允許put,怎么解決的
2017-10-13
源自:2小時學會Spring Boot 5-2
正在回答
是否按照老師講的來?
@RequestMapping(value = "student/{stuentId}", method = RequestMethod.PUT)public Student updateStudent(@PathVariable("stuentId") Integer stuentId, ? ? ? ? ? ? ? ? ? ? ? ? ? ? @RequestParam("studentName") String studentName, ? ? ? ? ? ? ? ? ? ? ? ? ? ? @RequestParam("studentSex") String studentSex, ? ? ? ? ? ? ? ? ? ? ? ? ? ? @RequestParam("studentPhone") String studentPhone, ? ? ? ? ? ? ? ? ? ? ? ? ? ? @RequestParam("studentAddress") String studentAddress) { ? ?Student student = new Student(); ? ?student.setStuentId(stuentId); ? ?student.setStudentName(studentName); ? ?student.setStudentSex(studentSex); ? ?student.setStudentAddress(studentAddress); ? ?student.setStudentPhone(studentPhone); ? ?return studentService.save(student);}
這個是我自己寫的,注意:id也要@PathVariable,其余參數再@RequestParam
沒問題了,我是}符號寫成]了
看來不只我一個人
14:40
舉報
Spring Boot入門視頻教程,你將學會使用Spring Boot快速構建應用程序
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2017-10-19
是否按照老師講的來?
@RequestMapping(value = "student/{stuentId}", method = RequestMethod.PUT)
public Student updateStudent(@PathVariable("stuentId") Integer stuentId,
? ? ? ? ? ? ? ? ? ? ? ? ? ? @RequestParam("studentName") String studentName,
? ? ? ? ? ? ? ? ? ? ? ? ? ? @RequestParam("studentSex") String studentSex,
? ? ? ? ? ? ? ? ? ? ? ? ? ? @RequestParam("studentPhone") String studentPhone,
? ? ? ? ? ? ? ? ? ? ? ? ? ? @RequestParam("studentAddress") String studentAddress) {
? ?Student student = new Student();
? ?student.setStuentId(stuentId);
? ?student.setStudentName(studentName);
? ?student.setStudentSex(studentSex);
? ?student.setStudentAddress(studentAddress);
? ?student.setStudentPhone(studentPhone);
? ?return studentService.save(student);
}
這個是我自己寫的,注意:id也要@PathVariable,其余參數再@RequestParam
2017-10-14
沒問題了,我是}符號寫成]了
2017-10-14
看來不只我一個人
2017-10-13
14:40