日期:2014-05-16 浏览次数:20420 次
在后台返回json格式的数据,然后用jquery读取分析。
后台
JSONObject json = new JSONObject(); List < Map > maps = new ArrayList < Map > (); List < Notice > notices = this .getNoticeService().findAll( this .getPageNo(), this .getPageSize()).getDatas(); SimpleDateFormat sdf = new SimpleDateFormat( " yyyyMMdd HH:mm:ss " ); for (Notice notice : notices) { Map < String, Object > property = new HashMap < String, Object > (); property.put( " noticeId " , notice.getNoticeId()); property.put( " title " , notice.getTitle()); property.put( " addTime " , sdf.format(notice.getAddTime())); maps.add(property); } json.put( " rows " , maps); this .renderText(json.toString());
前台
function PageClick(pageclickednumber){ var pageSize = 10 ; $.ajax({