jquery easyui datagrid 通过spring2.5.6 mvc 来传输数据,页面url改如何写,Controller里面如何写?
1个回答
展开全部
我也用springMVC写的代码,一般Controller里面这么写的:
@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里面的代码应该都差不多
可以参考一下我这边的写法
@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里面的代码应该都差不多
可以参考一下我这边的写法
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询