pageCount

package zpxx;
import java.sql.*;
import java.util.ArrayList;

public class pageCount {
   //出来输出的html代码
   public String StrDispPageTable="";
   //脚本文件名
   public String PageScriptName="";
   //待显示页码
   int IntOffset = 1;
   //下一页 
   int IntNext = 0;
   //上一页
   int IntPrv = 0;
   //一页显示的记录数
   int intPageSize = 10;
   //总页数
   public int intPageCount;
   //总记录数
   private int intRowCount;
  
  public void setpageCount(ResultSet rs) throws SQLException
  {
    if(rs != null ) {
   rs.last();
   intRowCount = rs.getRow();
   intPageCount = (intRowCount + intPageSize - 1) / intPageSize;
 }
  }

  public void setpageCountList( int arrayRs)
  {
    if(arrayRs > 0 ) {    
   intRowCount = arrayRs;
   intPageCount = (intRowCount + intPageSize - 1) / intPageSize;
 }
  }

  public void setScriptName(String Strvalue){
   PageScriptName = Strvalue;
  } 

  public void setPageSize(int value){
    intPageSize = value;
 intPageCount = (intRowCount + intPageSize - 1) / intPageSize;
  }

  public void setCurrentPage(int value){
    IntOffset = value;
    IntNext = IntOffset + 1;
    IntPrv = IntOffset - 1;
  }

  private int getTotalPages(){
    return intPageCount;
  } 

  private int getPageNext(){
    return IntNext;
  }

  private int getPagePrv(){
    return IntPrv;
  }

  private int getPageSize(){
    return intPageSize;
  }

  private int getCurrentPage() {
   return IntOffset;
  }


  public String getHtmlPageCount() {
      int Ipagenext = getPageNext();
      int Ipageprv = getPagePrv();
      int Ipages = getTotalPages();
   int IPS = getPageSize();
      int Icurpagenum = getCurrentPage();
  
     StrDispPageTable += "<table width=/"68%/" border=/"0/" cellspacing=/"0/" cellpadding=/"0/">";
      StrDispPageTable += "<tr align=/"center/">";
      if(IntOffset > 1) {
 StrDispPageTable += "<td width=/"5%/"><font face=/"Webdings/"><a href=/"" + PageScriptName +"?IRP=" + IPS +"&offset=1/">9</a></font></td>";}
       else {
 StrDispPageTable += "<td width=/"5%/"><font face=/"Webdings/">9</font></td>";
 }
      if(IntOffset > 1) {
        StrDispPageTable += "<td width=/"5%/"><font face=/"Webdings/"><a href=/""+ PageScriptName +"?IRP="+ IPS +"&offset="+ Ipageprv +"/">7</a></font></td>";}
       else {
        StrDispPageTable += "<td width=/"5%/"><font face=/"Webdings/">7</font></td>";
       }
      StrDispPageTable += "<td width=/"10%/">[<font color=/"#FF0000/">"+ Icurpagenum +"</font>]</td>";
      if(IntOffset < intPageCount) {
        StrDispPageTable += "<td width=/"5%/"><font face=/"Webdings/"><a href=/""+ PageScriptName +"?IRP="+ IPS +"&offset="+ Ipagenext +"/">8</a></font></td>";}
       else {
        StrDispPageTable += "<td width=/"5%/"><font face=/"Webdings/">8</font></td>";
       }
      if(IntOffset < intPageCount) {
        StrDispPageTable += "<td width=/"5%/"><font face=/"Webdings/"><a href=/""+ PageScriptName +"?IRP="+ IPS +"&offset="+ intPageCount +"/">:</a></font></td>";}
       else {
        StrDispPageTable += "<td width=/"5%/"><font face=/"Webdings/">:</font></td>";
       }
      StrDispPageTable += "<td> 跳转到";
      StrDispPageTable += "<select name=/"menu1/" onChange=/"MM_jumpMenu('self',this,0)/">";
      StrDispPageTable += "<option value=/""+ PageScriptName +"/">..</option>";
      for(int i=1;i<=Ipages;i++) {
 StrDispPageTable += "<option value=/""+ PageScriptName +"?IRP="+ IPS +"&offset=" + i +"/">"+ i +"</option>";
 }
      StrDispPageTable += "</select> 页 </td>";
      StrDispPageTable += "<td>共"+ Ipages +"页/每页显示";
      StrDispPageTable += "<select name=/"menu2/" size=/"1/" onChange=/"MM_jumpMenu('self',this,0)/">";
      if(intPageSize == 10)
 StrDispPageTable += "<option value=/""+ PageScriptName +"?IRP=10/" selected>10</option>";
       else {
 StrDispPageTable += "<option value=/""+ PageScriptName +"?IRP=10/">10</option>";}
      if(intPageSize == 20)
 StrDispPageTable += "<option value=/""+ PageScriptName +"?IRP=20/" selected>20</option>";
       else
 StrDispPageTable += "<option value=/""+ PageScriptName +"?IRP=20/">20</option>";
      if(intPageSize == 30)
 StrDispPageTable += "<option value=/""+ PageScriptName +"?IRP=30/" selected>30</option>";
       else
 StrDispPageTable += "<option value=/""+ PageScriptName +"?IRP=30/">30</option>";
      if(intPageSize == 40)
 StrDispPageTable += "<option value=/""+ PageScriptName +"?IRP=40/" selected>40</option>";
       else
 StrDispPageTable += "<option value=/""+ PageScriptName +"?IRP=40/">40</option>";
      if(intPageSize == 50)
 StrDispPageTable += "<option value=/""+ PageScriptName +"?IRP=50/" selected>50</option>";
       else
 StrDispPageTable += "<option value=/""+ PageScriptName +"?IRP=50/">50</option>";
      if(intPageSize == 100)
 StrDispPageTable += "<option value=/""+ PageScriptName +"?IRP=100/" selected>100</option>";
       else
 StrDispPageTable += "<option value=/""+ PageScriptName +"?IRP=100/">100</option>";
 
    StrDispPageTable += "</select>条记录</td>";
    StrDispPageTable += "</tr></table>";
   
   return  StrDispPageTable;
   }
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值