?? dividepage.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: DividePage.java
package dispose;
import com.zyf.tools.connectdb.DBOS;
import java.sql.ResultSet;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpSession;
public class DividePage
{
public int rTotal;
public int perTotal;
public int pageTotal;
public int recordP;
public int reqPageNum;
public String reqPageNo;
public String pageURL;
public String pageInfo[] = {
"", "", "", "", "", ""
};
public String selP;
public String sel;
public DBOS oper;
public HttpSession session;
public ServletRequest request;
public DividePage()
{
rTotal = 0;
perTotal = 10;
pageTotal = 0;
recordP = 0;
reqPageNum = 0;
reqPageNo = "0";
pageURL = "";
oper = new DBOS();
}
public void setPagePara(HttpSession httpsession, ServletRequest servletrequest, String s, int i, String s1)
{
session = httpsession;
request = servletrequest;
sel = s;
perTotal = 15;
pageURL = s1;
}
public Object[][] getResult()
throws Exception
{
reqPageNo = request.getParameter("pageNo");
if(session.getAttribute("selP") != null)
selP = session.getAttribute("selP").toString();
if(reqPageNo != null)
sel = selP;
oper.sexe(sel);
session.setAttribute("selP", sel);
session.setAttribute("perTotal", Integer.toString(perTotal));
if(!oper.result.last())
{
return null;
} else
{
rTotal = oper.result.getRow();
getRecordP();
Object aobj[][] = oper.selResult(recordP + 1, perTotal);
oper.releaseResource();
return aobj;
}
}
public void getRecordP()
{
if(rTotal % perTotal > 0)
pageTotal = rTotal / perTotal + 1;
else
pageTotal = rTotal / perTotal;
if(reqPageNo == null)
reqPageNo = "1";
reqPageNum = Integer.parseInt(reqPageNo);
if(reqPageNum < 1)
reqPageNum = 1;
if(reqPageNum > pageTotal)
reqPageNum = pageTotal;
recordP = (reqPageNum - 1) * perTotal;
}
public String[] getPageInfo()
{
if(rTotal % perTotal > 0)
pageTotal = rTotal / perTotal + 1;
else
pageTotal = rTotal / perTotal;
if(reqPageNo == null)
reqPageNo = "1";
reqPageNum = Integer.parseInt(reqPageNo);
if(reqPageNum < 1)
reqPageNum = 1;
if(reqPageNum > pageTotal)
reqPageNum = pageTotal;
if(reqPageNum > 1)
{
pageInfo[0] = "<a href=\"" + pageURL + "?pageNo=1\">第一頁</a>";
int i = Integer.parseInt(reqPageNo, 10);
if(i > 1)
i--;
String s = Integer.toString(i);
pageInfo[1] = "<a href=\"" + pageURL + "?pageNo=" + s + "\">上一頁</a>";
}
if(reqPageNum < pageTotal)
{
int j = Integer.parseInt(reqPageNo, 10);
if(j < pageTotal)
j++;
String s1 = Integer.toString(j);
pageInfo[2] = "<a href=\"" + pageURL + "?pageNo=" + s1 + "\">下一頁</a>";
pageInfo[3] = "<a href=\"" + pageURL + "?pageNo=" + pageTotal + "\">最后頁</a>";
}
if(reqPageNum > pageTotal)
reqPageNum = pageTotal;
pageInfo[4] = "結(jié)果共" + pageTotal + "頁";
pageInfo[5] = "顯示第" + reqPageNum + "頁";
return pageInfo;
}
public void clear()
{
session = null;
request = null;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -