• jqPaginator分页插件


    如下图效果:

    官方地址:http://jqpaginator.keenwon.com/

     

    java后台代码Page对象:

    /**
     * 
     * All Rights Reserved. 保留所有权利.
     */
    package com.sh.portal.util;
    
    /**
     * @Author: jsun
     * @Create: 2013-7-25 下午3:32:39
     * @Version: 1.0
     * @Description:
     */
    public class PageUtil {
    	
    	public final static Integer PAGE_SIZE = 10;
    	
    	/**
    	 * 每页显示条数
    	 */
    	private int pageSize;
    	
    	/**
    	 * 页码
    	 */
    	private int pageNumber;
    	
    	/**
    	 * 开始记录
    	 */
    	private int start;
    	
    	/**
    	 * 总记录数
    	 */
    	private int totalRecords;
    	
    	/**
    	 * 总页数
    	 */
    	private int totalPage;
    
    	
    	/**
    	 * 
    	 * @param pageNumber		页码
    	 * @param pageSize	每页条数
    	 * @param totalRecords	总记录数
    	 */
    	public PageUtil(int pageNumber, int pageSize, int totalRecords){
    		if(pageSize == 0) {
    			this.pageSize = PAGE_SIZE;
    		}else{
    			this.pageSize = pageSize;
    		}
    		
    		setTotalRecords(totalRecords);
    		
    		this.pageNumber = DataFormat.parseInt(pageNumber, 1);
    		if (this.pageNumber <= 0) {
    			this.pageNumber = 1;
    		} else if (this.pageNumber > totalPage && totalPage > 0) {
    			this.pageNumber = totalPage;
    		}
    		if (totalPage == 0) {
    			this.pageNumber = 1;
    		}	
    		
    		this.start =  (this.pageNumber - 1) * this.pageSize;
    	}
    	
    	public PageUtil(int pageNumber, int pageSize){
    		this.pageSize = pageSize;
    		this.pageNumber = DataFormat.parseInt(pageNumber, 1);
    		this.start = (this.pageNumber - 1) * this.pageSize;
    	}
    	
    	public PageUtil(){
    		this.pageSize = PAGE_SIZE;
    		this.pageNumber = 1;
    		this.start = (this.pageNumber - 1) * this.pageSize;
    	}
    	
    	public int getPageNumber() {
    		return pageNumber;
    	}
    
    	public void setPageNumber(int pageNumber) {
    		this.pageNumber = pageNumber;
    	}
    
    	public int getStart() {
    		this.start = (this.pageNumber - 1) * this.pageSize;
    		return start;
    	}
    
    	public void setStart(int start) {
    		this.start = start;
    	}
    
    	public int getTotalRecords() {
    		return totalRecords;
    	}
    
    	public void setTotalRecords(int totalRecords) {
    		
    		int temp = totalRecords % pageSize;
    		
    		if (temp == 0){
    			this.totalPage = totalRecords / pageSize;
    		}else{
    			this.totalPage = totalRecords / pageSize + 1;
    		}
    		if(this.pageNumber < 1){
        		this.pageNumber = 1;
        	} else if(this.getTotalPage() < this.pageNumber){
        		this.pageNumber = this.totalPage;
        	}
    		this.totalRecords = totalRecords;
    	}
    
    	public int getTotalPage() {
    		return totalPage;
    	}
    
    	public void setTotalPage(int totalPage) {
    		this.totalPage = totalPage;
    	}
    
    	public int getPageSize() {
    		return pageSize;
    	}
    
    	public void setPageSize(int pageSize) {
    	    if(this.pageNumber > 0){
    	        this.start = (this.pageNumber - 1) * this.pageSize;
    	    }
    		this.pageSize = pageSize;
    	}
    	
    	
    	
    }
    

      

    • 相关阅读:
      ACM-ICPC 2018 徐州赛区网络预赛 F Features Track(STL模拟)
      ACM-ICPC 2018 徐州赛区网络预赛 H Ryuji doesn't want to study (树状数组差分)
      数位dp
      Number String
      The King’s Ups and Downs
      容斥定理
      Anagram(山东省2018年ACM浪潮杯省赛)
      STL——queue
      lower_bound和upper_bound使用说明
      int string相互转换
    • 原文地址:https://www.cnblogs.com/holdon521/p/4748333.html
    Copyright © 2020-2023  润新知