日期:2014-05-16  浏览次数:20401 次

jquery 异步调用业务层的方法,然后返回一个list。在jsp页面上填充

在后台返回json格式的数据,然后用jquery读取分析。

后台

Java code
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());


前台

JScript code
function PageClick(pageclickednumber){ var pageSize = 10 ; $.ajax({