put请求测试不成功
不允许put,怎么解决的
不允许put,怎么解决的
2017-10-13
是否按照老师讲的来?
@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
举报