Home  >  Article  >  Database  >  MySql实现分页_MySQL

MySql实现分页_MySQL

WBOY
WBOYOriginal
2016-06-01 13:08:391165browse

(1)创建分页模型pageBean,里面有三个值,当前页page,每页记录数pageSize,起始页start=(page-1)*pageSize
(2)在dao层实现从数据库查询和获取记录数的方法:sql.append(" limit "+pagebean.getStart()+","+pagebean.getPageSize());
(3)在servlet层实现分页代码,这里传入的值有当前页page,总记录数total,以及从properties中取得的pageSize值
(4)在jsp显示页面使用el表达式获取pageCode值,这个值是生成的分页的html代码,String类型。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn