📄 page.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: page.java
package com.zh.util;
import com.zh.conpool.Condata;
import java.io.PrintStream;
import java.sql.ResultSet;
import java.sql.SQLException;
public class page
{
ResultSet rs;
ResultSet rst;
private int intCountTopic;
public int intPageSize;
public int intPageCount;
public int intPage;
private String Countsql;
private String Pagisql;
private String str;
private String str_where;
private String str_parameter;
private String nowPage;
private String HttpFile;
Condata db;
public page()
{
rs = null;
rst = null;
intCountTopic = 0;
intPage = 0;
Countsql = null;
Pagisql = null;
str = null;
str_where = null;
str_parameter = "";
db = new Condata();
}
public void setPages(int n)
{
intPageSize = n;
}
public String getPagisql()
{
return Pagisql;
}
public ResultSet setQuerysql(String str_table, String str_where, String httpfile, String pages)
throws SQLException
{
ResultSet rs1= null;
nowPage = pages;
HttpFile = httpfile;
Countsql = "select count(*) from " + str_table + " " + str_where;
Pagisql = "select * from " + str_table + " " + str_where + " order by id desc";
try
{
db.getConnection();
}
catch(Exception e)
{
e.getMessage();
}
try
{
rs1= querySql(Countsql, Pagisql);
}
catch(SQLException ex)
{
ex.getMessage();
}
return rs1;
}
public ResultSet querySql(String Countsql, String Pagisql)
throws SQLException
{
try
{
Condata _tmp = db;
Condata.getConnection();
}
catch(Exception e) { }
if(nowPage == null)
{
intPage = 1;
} else
{
intPage = Integer.parseInt(nowPage);
if(intPage < 1)
intPage = 1;
}
rs = db.executeQuery(Countsql);
if(rs.next())
intCountTopic = rs.getInt(1);
intPageCount = intCountTopic % intPageSize != 0 ? intCountTopic / intPageSize + 1 : intCountTopic / intPageSize;
if(intPage > intPageCount)
intPage = intPageCount;
rs.close();
rst = db.executeQuery(Pagisql);
return rst;
}
public int getCountTopic()
{
return intCountTopic;
}
public int getPageCount()
{
return intPageCount;
}
public int getIntPage()
{
return intPage;
}
public String PageFooter()
{
String str = "<form action=" + HttpFile + " name=form1 methord=post>";
int prev = intPage - 1;
int next = intPage + 1;
int aaa=(intPageSize * getIntPage() + 1) - intPageSize;
if(aaa<0){
aaa=0;
}
str = str + "<font style='font-size: 9pt'>总计<font color='red'>" + getCountTopic() + "</font>条记录," + "【共<font color='red'>" + getPageCount() + "</font>页】";
str = str + "【" + intPageSize + "条/页】 当前第<font color='red'>" + getIntPage() + "</font>页(列出第" + aaa + "到第" + getIntPage() * intPageSize + "条) ";
if(intPage > 1)
str = str + " <A href=" + HttpFile + "?pages=1" + str_parameter + ">首页</A> ";
else
str = str + " 首页 ";
if(intPage > 1)
str = str + " <A href=" + HttpFile + "?pages=" + prev + str_parameter + ">上一页</A> ";
else
str = str + " 上一页 ";
if(intPage < intPageCount)
str = str + " <A href=" + HttpFile + "?pages=" + next + str_parameter + ">下一页</A> ";
else
str = str + " 下一页 ";
if(intPageCount > 1 && intPage != intPageCount)
str = str + " <A href=" + HttpFile + "?pages=" + intPageCount + str_parameter + ">尾页</A>";
else
str = str + " 尾页</font>";
str = str + "</form>";
return str;
}
public void closeConn()
{
db.close();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -