码上敲享录 > jquery入门实例分享 > jquery的DataTable的java后台返回的数据结构

jquery的DataTable的java后台返回的数据结构

上一章章节目录下一章 2019-04-09已有1372人阅读 评论(0)

jquery的DataTable的java后台返回的数据结构


解决方法:

Map<String,Object>  context = getRootMap();

context.put("draw","");

context.put("recordsTotal",20);

context.put("recordsFiltered",10);

List<Map<String,String>> datas=new ArrayList<Map<String,String>>();


Map jsonObject = new HashMap();

jsonObject.put("0", "第一列的值");

jsonObject.put("1", "第二列的值");

jsonObject.put("2", "第三列的值");

jsonObject.put("3", "第四列的值");

jsonObject.put("4", "第五列的值");

jsonObject.put("5", "第六列的值");

jsonObject.put("6", "第七列的值");

datas.add(jsonObject);

context.put("data",datas);

try {

StringBuffer result = new StringBuffer();

//设置页面不缓存

response.setHeader("Pragma", "No-cache");

response.setHeader("Cache-Control", "no-cache");

response.setCharacterEncoding("UTF-8");

                       response.setContentType("application/x-javascript;charset=UTF-8");

PrintWriter out= null;

out = response.getWriter();

out.print(JSONUtil.toJSONString(context));

out.flush();

out.close();

} catch (IOException e) {

e.printStackTrace();

}




向大家推荐《Activiti工作流实战教程》:https://xiaozhuanlan.com/activiti
0

有建议,请留言!

  • *您的姓名:

  • *所在城市:

  • *您的联系电话:

    *您的QQ:

  • 咨询问题:

  • 提 交