public class PageVo { /** 总记录数 */ protected Integer totalCount = 0; /** 总共有多少页 */ protected Integer totalPage = 0; /** 第几页 */ protected Integer pageNo = 1; /** 每页显示条数 */ protected Integer pageSize = 10; /** 表格中的数据 */ protected List<?> rows; }
@RequestMapping("list") public void list(PageVo pageVo, HttpServletResponse response) { PageVo page = adminGoodsService.page(pageVo); super.jsonPage(page, response); }
<table > <thead> <tr> <th>流水号</th> <th>ID</th> <th>分类</th> <th>名称</th> <th>标题</th> <th>现价</th> <th>原价</th> <th>浏览量</th> <th>创建时间</th> <th>状态</th> <th>操作</th> </tr> </thead> <tbody id="bodyHolder"></tbody> </table> <div id="pageHolder"></div>
<script> (function() { var fuPage = new FuPage( { "url" : "/goods/list.html", "params" : { "pageNo" : 1, "pageSize" : 1 }, "bodyHolder" : "bodyHolder", "pageHolder" : "pageHolder", "tableTemplate" : "<tr><td>{id}</td><td>{goodsId}</td></tr>" }); fuPage.send(); })(); </script>
function FuPage(options) { this.url = options.url; this.params = options.params; this.startNo = 1; this.endNo = 1; this.tableTemplate = options.tableTemplate; this.bodyHolder=options.bodyHolder; this.pageHolder=options.pageHolder; } //发送请求并渲染table FuPage.prototype.send = function() { var that = this; $.post(this.url, this.params, function(data) { var page = data.page; if (that.isTable) { that.renderTable(page); } else { that.renderList(that, page); } renderPage(that, page); addPageEvent(that, page); }); } FuPage.prototype.renderTable = function(page) {} // 渲染分页栏 function renderPage(fuPage, page) {} // 为分页超链接绑定click事件 function addPageEvent(fuPage, page) {}
时候不早了,抽空续写,感谢大家“收看” ~
小雷FansUnion-博学的互联网技术工作者
2015年1月7日-凌晨
湖北-武汉-循礼门
电子商务系统的设计与实现(十三):分页组件,从前到后,从JS到Java
原文地址:http://blog.csdn.net/fansunion/article/details/42474801