关于JSONObject的一个很奇怪的问题

圣僧散散心 2015-06-05 11:00:15
我使用dategrid显示数据,前段时间没有问题的,但是现在出现这么一个问题。
刚开始初始化dategrid没有问题,json数据也没有问题。如图:

JSON数据也没有问题:
{"total":15,"rows":[{"date":null,"gender":"男","studentName":"夏明","remark":"","id":1,"age":15},{"date":null,"gender":"男","studentName":"刘兴","remark":"","id":2,"age":16},{"date":null,"gender":"女","studentName":"李小梅","remark":"","id":3,"age":15},{"date":null,"gender":"男","studentName":"李明明","remark":"","id":4,"age":17},{"date":null,"gender":"男","studentName":"洪笑天","remark":"","id":5,"age":18},{"date":null,"gender":"女","studentName":"刘莹莹","remark":"","id":6,"age":14},{"date":null,"gender":"女","studentName":"赵玉","remark":"","id":7,"age":15},{"date":null,"gender":"女","studentName":"赵薇","remark":"","id":8,"age":23},{"date":null,"gender":"男","studentName":"赵子龙","remark":"","id":9,"age":12},{"date":null,"gender":"男","studentName":"关羽","remark":"","id":10,"age":14}]}

但是当我点击下一页(图中红圆圈处),数据没有更新,显示第二页:


ACTION中部分代码:
public String getAllStudentInfo() throws Exception
{

List<StudentInfo> Studentlist = studentInfo_services.getAllStudentInfo(rows, page);
Map<String, Object> jsonMap = new HashMap<String, Object>();
jsonMap.put("total", studentInfo_services.getStudentTotal());//total键 存放总记录数,必须的
jsonMap.put("rows", Studentlist);//rows键 存放每页记录 list
result=JSONObject.fromObject(jsonMap);
return SUCCESS;
}

我查看了一下,当显示第一页时,都完全正常,result=JSONObject.fromObject(jsonMap);这句话能够正常执行,但是当点击下一页的时候,Studentlist 中的数据也是对的,但是result=JSONObject.fromObject(jsonMap);这句话就不执行了。自然JSON数据也没有了。不知道什么原因。那句话为什么有选择性的执行?前段时间还好好的。随着编写增删改查后,出现这种现象,无语了。

大神帮帮忙
...全文
137 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
圣僧散散心 2015-06-05
  • 打赏
  • 举报
回复
顶~~~~~~
圣僧散散心 2015-06-05
  • 打赏
  • 举报
回复
顶一下。。。。
圣僧散散心 2015-06-05
  • 打赏
  • 举报
回复
好吧 我自己找到原因了。 json-lib的库无法处理date类型的数据,我前面几行数据中date类型的数据是null,但后面几行数据中date类型数据非null,导致那条语句无法执行了~~~ 给大家一个参考吧

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧