第一种方法:
function insert(){
var val = {"stuNum":4,"name":"stu4","classNum":4};
$.ajax({
type:"POST",
url:"../test/yn/insert",
dataType: "json",
data:val,
success: function(student){
defaultPage();
}
})
}
@RequestMapping("insert")
@ResponseBody
public Student methodsInsert(int stuNum,String name,int classNum){
Student student = new Student(stuNum,name,classNum);
stuService.insertStudent(student);
System.out.println(name);
return new Student();
}