@RequestMapping(value = "/mng/getappinfo", method = RequestMethod.POST)
@ResponseBody //別人跟我說加了這行返回json數據,不加只有上面那行會返回壹個頁面
public griddata getAppInfo(
@RequestParam(value = "user", required = false) String user,
@RequestParam(value = "roleid", required = false) String roleid){
griddata gdata = new griddata(appInfoService.getAppInfo(user));//這裏從數據庫獲取字段,是個list
return gdata;
}
// 下面這個是griddata的類
public class griddata {
public griddata() {
super();
}
public griddata(List rows) {
super();
this.rows = rows;
}
private List rows;
public List getRows() {
return rows;
}
public void setRows(List rows) {
this.rows = rows;
}
}
js裏面的代碼應該都差不多
可以參考壹下我這邊的寫法