Posted on 2006-06-13 12:45
sound 閱讀(761)
評論(0) 編輯 收藏
<%@ page contentType="text/html; charset=gb2312" %>
<%
/*
Inberkong
inber520@yahoo.com.cn
QQ:27096282
數(shù)組分頁技術(shù)
arrayTest.jsp
*/
String [] contentArray={};
contentArray=new String[125];
for(int i=0;i<125;i++)
{
contentArray[i]="ayyayValue"+String.valueOf(i);
}
int intRowCount; //記錄總數(shù) 125
int intPage=-1; //待顯示頁碼
int intPageCount; //總頁數(shù)
int intPageSize; //一頁顯示的記錄數(shù) 6
intPageSize = 6;
if(request.getParameter("pages")==null)
intPage=1;
else
intPage=Integer.parseInt(request.getParameter("pages"));
intRowCount=125;//記錄總數(shù)
//記算總頁數(shù)
intPageCount = (intRowCount+intPageSize-1) / intPageSize;
int startRecord=(intPage-1)*intPageSize;
int endRecord=(intPage*intPageSize-1);
while(startRecord<=endRecord && startRecord<=(intRowCount-1))
{
out.print("contentArray["+startRecord+"]:"+contentArray[startRecord]+"
");
startRecord=startRecord+1;
}
%>
|
首頁
<%
if((intPage-1)<1)
out.print("上一頁");
else
out.print("上一頁");
%>
<%
if(intPage下一頁");
else
out.print("下一頁");
%>
尾頁 |