mysql分页怎么实现 mysql分页实现原理( 六 )


/tr
%
if(intPageCount0){
将记录指针定位到待显示页的第一条记录上
sqlRst.absolute((intPage-1) * intPageSize + 1);
显示数据
i = 0;
while(iintPageSize!sqlRst.isAfterLast()){
%
tr
td%=sqlRst.getString(1)%/td
td%=sqlRst.getString(2)%/td
/tr
%
sqlRst.next();
i++;
}
}
%
/table
第%=intPage%页 共%=intPageCount%页 %if(intPageintPageCount){%a href="https://www.04ip.com/post/jdbc20-oracle.jsp?page=%=intPage+1%"下一页/a%}% %if(intPage1){%a href="https://www.04ip.com/post/jdbc20-oracle.jsp?page=%=intPage-1%"上一页/a%}%
/body
/
%
关闭结果集
sqlRst.close();
关闭SQL语句对象
sqlStmt.close();
关闭数据库
sqlCon.close();
%
可以试试先!
祝你好运!
----------------------------------
也可以用jsp+xml+来实现,下面给出一个saucer(思归)给的xml+的分页例子 , 不妨参考一下:
body
!--the following XML document is "stolen" from MSXML4 documentation--
xml id="xmldoc"
catalog
book id="bk101"
authorGambardella, Matthew/author
titleXML Developer's Guide/title
genreComputer/genre
price44.95/price
publish_date2000-10-01/publish_date
descriptionAn in-depth look at creating applications
with XML./description
/book
book id="bk102"
authorRalls, Kim/author
titleMidnight Rain/title
genreFantasy/genre
price5.95/price
publish_date2000-12-16/publish_date
descriptionA former architect battles corporate zombies,
an evil sorceress, and her own childhood to bee queen
of the world./description
/book
book id="bk103"
authorCorets, Eva/author
titleMaeve Ascendant/title
genreFantasy/genre
price5.95/price
publish_date2000-11-17/publish_date
descriptionAfter the collapse of a nanotechnology
society in England, the young survivors lay the
foundation for a new society./description
/book
book id="bk104"
authorCorets, Eva/author
titleOberon's Legacy/title
genreFantasy/genre
price5.95/price
publish_date2001-03-10/publish_date
descriptionIn post-apocalypse England, the mysterious
agent known only as Oberon helps to create a new life
for the inhabitants of London. Sequel to Maeve
Ascendant./description
/book
book id="bk105"
authorCorets, Eva/author
titleThe Sundered Grail/title
genreFantasy/genre
price5.95/price
publish_date2001-09-10/publish_date
descriptionThe o daughters of Maeve, half-sisters,
battle one another for control of England. Sequel to
Oberon's Legacy./description
/book
book id="bk106"
authorRandall, Cynthia/author
titleLover Birds/title
genreRomance/genre
price4.95/price
publish_date2000-09-02/publish_date
descriptionWhen Carla meets Paul at an ornithology
conference, tempers fly as feathers get ruffled./description
/book
book id="bk107"
authorThurman, Paula/author
titleSplish Splash/title
genreRomance/genre
price4.95/price
publish_date2000-11-02/publish_date
descriptionA deep sea diver finds true love enty
thousand leagues beneath the sea./description
/book
book id="bk108"
authorKnorr, Stefan/author
titleCreepy Crawlies/title
genreHorror/genre
price4.95/price
publish_date2000-12-06/publish_date
descriptionAn anthology of horror stories about roaches,
centipedes, scorpions and other insects./description
/book
/catalog
/xml
table id="mytable" datasrc="http://img.readke.com/231126/0H03243F-0.jpg" border=1 DATAPAGESIZE="2"

推荐阅读