这个list集合中的数据已经测试了,可以取到
@RequestMapping(value="/findCost",method=RequestMethod.POST)
@ResponseBody
public Object findCost(HttpServletRequest request) throws Exception{
List costs= costService.findAll();
return costs;
}
有个一table id是dg,changeme为工程名,其中定义的列名都可以正常显示,但是post请求时报406错误,数据都不显示
$(function () {
$('#dg').datagrid(
{
url :'/changeme/findCost',
method : 'post',
title : '资费列表',
iconCls : 'icon-save',
loadMsg : '数据加载中,请稍后......',
fitColumns : true,
striped : true,
singleSelect : true,
rownumbers : true,
columns : [ [
{
field : 'id',
checkbox : true,
width : 10
},
{
field : 'name',
title : '资费名称',
width : 300,
},
{
field : 'baseDuration',
title : '基本时长',
width : 200,
sortable :true
},
{
field : 'baseCost',
title : '基本费用',
width : 200,
sortable :true
},
{
field : 'unitCost',
title : '单位费用',
width : 200,
sortable :true
},
{
field : 'createTime',
title : '创建时间',
width : 200
},
{
field : 'startTime',
title : '开通时间',
width : 200
},
{
field : 'status',
title : '状态',
width : 200,
formatter : function(value) {
if (value == "0") {
return "开通";
} else if (value=="1"){
return "暂停";
}else{
return null;
}
}
}
] ],
toolbar : [ {
text : '添加',
iconCls : 'icon-add',
handler : function() {
// 跳转到添加页面
$('#content').load('/addCost');
}
}, '-', {
text : '删除',
iconCls : 'icon-remove',
handler : function() {
// 跳转到添加页面
var index = $('#dg input:checkbox').value;
del(index);
}
}, '-', {
text : '修改',
iconCls : 'icon-edit',
handler : function() {
view();
}
}]
} );
} );