起因:jquery datable 异步获取数据时必须返回JSON格式,mybatis查询的结果直接传到前端会报错如下:
mybatis返回结果转换为JSON格式

直接用JSONArray无法实现转换,最后使用Gson配合JSONArray成功将结果集转换为json
mybatis返回结果转换为JSON格式
mybatis返回结果转换为JSON格式
代码:Gson gson = new Gson();
String jsonResult = gson.toJson(dataList, new TypeToken<List>(){}.getType());
JSONArray object = JSONArray.parseArray(jsonResult);

so,问题解决_

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-28
  • 2021-12-26
  • 2022-03-06
  • 2022-01-28
  • 2022-01-26
猜你喜欢
  • 2021-12-22
  • 2021-12-06
  • 2022-01-14
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
相关资源
相似解决方案