谁能介绍一下spring框架中的分页机制,或者举个小列子?

来源:百度知道 编辑:UC知道 时间:2024/05/26 05:57:06
谁能介绍一下spring框架中的分页机制,或者举个小列子?

package com.deity.ranking.util;import Java.util.List;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.support.JdbcDaoSupport;
/** * 分页函数 * * @author allenpan */public class Pagination extends JdbcDaoSupport{
public static final int NUMBERS_PER_PAGE = 10;
//一页显示的记录数
private int numPerPage;
//记录总数
private int totalRows;
//总页数
private int totalPages;
//当前页码
private int currentPage;
//起始行数
private int startIndex;
//结束行数
private int lastIndex;
//结果集存放List
private List resultList;
//JdbcTemplate jTemplate
private JdbcTemplate jTemplate;
/**
* 每页显示10条记录的构造函数,使用该函数必须先给Pagination设置currentPage,jTemplate初值
* @param sql oracle语句
*/
public Pagination(String sql){
if(jTemplate == null){
throw new IllegalArgumentException("com.deity.ranking.util.Pagination.jTemplate i