zoukankan      html  css  js  c++  java
  • 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;
    	}
    	
    	
    	
    }
    

      

    • 相关阅读:
      Java.io.outputstream.PrintStream:打印流
      Codeforces 732F. Tourist Reform (Tarjan缩点)
      退役了
      POJ 3281 Dining (最大流)
      Light oj 1233
      Light oj 1125
      HDU 5521 Meeting (最短路)
      Light oj 1095
      Light oj 1044
      HDU 3549 Flow Problem (dinic模版 && isap模版)
    • 原文地址:https://www.cnblogs.com/holdon521/p/4748333.html
    Copyright © 2011-2022 走看看