pagebean.java

来自「一个简易的网上书店(jsp+sqlservler+struts)。」· Java 代码 · 共 44 行

JAVA
44
字号
package com.webshop.page;

/**
 * @author hellking
 *
 * To change this generated comment edit the template variable "typecomment":
 * Window>Preferences>Java>Templates.
 * To enable and disable the creation of type comments go to
 * Window>Preferences>Java>Code Generation.
 */
import java.util.Vector;

public class PageBean
{
	public int curPage ; //当前是第几页 
	public int maxPage ; //一共有多少页 
	public int maxRowCount ; //一共有多少行 
	public int rowsPerPage=5 ;//每页多少行
	public java.util.Vector data;
	public PageBean()
	{
	}
	public void countMaxPage() {   //根据总行数计算总页数  
    if (this.maxRowCount % this.rowsPerPage==0){
       this.maxPage = this.maxRowCount/this.rowsPerPage;
    }else{
       this.maxPage = this.maxRowCount/this.rowsPerPage + 1;        
        }
    }
    public Vector getResult()
    {
    	return this.data;
    }
    
    public PageBean(PageBusiness pageBusiness,String con)throws Exception
    {
    	 this.maxRowCount = pageBusiness.getAvailableCount(con);  //得到总行数
   		 this.data    = pageBusiness.getResult();          //得到要显示于本页的数据
    	 this.countMaxPage();       //计算总页数
    }   
}               
    	 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?