Я хочу вызвать метод в классе POJO в сценарии сетки jquery.Отображение запроса Spring в сетке jquery
jQuery("#list2").jqGrid({
datatype: "json",
url:"/showStudent.do",
type:"",
colNames:['Student Name','Age', 'Mobile'],
colModel:[
{name:'name',index:'id', width:55,formatter:custom_func},
{name:'age', width:90},
{name:'mobile', width:100},
],
rowNum:10,
rowList:[10,20,30],
sortname: 'id',
viewrecords: true,
sortorder: "desc",
caption:"Student List"
});
так выше взглядом по умолчанию для метода GET, но класс назначения не имеют, что
@RequestMapping("/showStudent.do")
public String showEnrolledStudent(Model model)
{
PersistenceManager pm=PMF.get().getPersistenceManager();
Query query=pm.newQuery(Student.class);
JSONArray studentListJson=new JSONArray();
try
{
List<Student> listOfStudent=(List<Student>) query.execute();
for(Student student:listOfStudent)
{
JSONObject jsonObject=new JSONObject();
jsonObject.put("name", student.getName());
jsonObject.put("age", student.getAge());
jsonObject.put("mobile", student.getMobile());
studentListJson.put(jsonObject);
}
}
catch (Exception e) {
}
System.out.println("hi");
System.out.println(studentListJson);
return studentListJson.toString();
}
Итак, как можно сделать связывание между JQuery сетки URL-адрес вызова showEnrolledStudent() метод.