后台使用oracle前台使用easyui分页机制

前台easyui 的datagrid中设置分页属性:

pagination:true,//显示分页
pagePosition:'bottom',//分页栏位置 both 上下 bottom、top
pageList:[12,24,36]//分页数据大小

后台java代码中 int page ,int rows写set、 get方法。

page = Integer.parseInt(request.getParameter("page"));
rows = Integer.parseInt(request.getParameter("rows"));
startIndex=(page-1)*rows;

后台oracle分页使用rownum来进行分页。sql语句实例

select *

from (

 select id,name,rownum as num

 from student

)

where num between 10 and 20

记住rownum必须使用别名,并且不能使用>=和<=,仅仅能使用between and 。

后台向前台传递Json数据,包含total和rows。

原文地址:https://www.cnblogs.com/mengfanrong/p/5155113.html