当前位置: 技术问答>java相关
JSP数据库分页显示的问题
来源: 互联网 发布时间:2015-08-28
本文导语: 一个论坛(如CSDN)的帖子如何实现分页显示 表 id自增长 | 作为参考: JSP数据库操作例程 - 数据分页显示 - JDBC 2.0 - Oracle 姓名 年龄 0){ //将记录指针定位...
一个论坛(如CSDN)的帖子如何实现分页显示
表 id自增长
表 id自增长
|
作为参考:
JSP数据库操作例程 - 数据分页显示 - JDBC 2.0 - Oracle
姓名
年龄
0){
//将记录指针定位到待显示页的第一条记录上
sqlRst.absolute((intPage-1) * intPageSize + 1);
//显示数据
i = 0;
while(i
第页 共页 下一页 1){%>上一页
可以试试先!
祝你好运!
JSP数据库操作例程 - 数据分页显示 - JDBC 2.0 - Oracle
姓名
年龄
0){
//将记录指针定位到待显示页的第一条记录上
sqlRst.absolute((intPage-1) * intPageSize + 1);
//显示数据
i = 0;
while(i
第页 共页 下一页 1){%>上一页
可以试试先!
祝你好运!
|
也可以用jsp+xml+html来实现,下面给出一个saucer(思归)给的xml+html的分页例子,不妨参考一下:
Gambardella, Matthew
XML Developer's Guide
Computer
44.95
2000-10-01
An in-depth look at creating applications
with XML.
Ralls, Kim
Midnight Rain
Fantasy
5.95
2000-12-16
A former architect battles corporate zombies,
an evil sorceress, and her own childhood to become queen
of the world.
Corets, Eva
Maeve Ascendant
Fantasy
5.95
2000-11-17
After the collapse of a nanotechnology
society in England, the young survivors lay the
foundation for a new society.
Corets, Eva
Oberon's Legacy
Fantasy
5.95
2001-03-10
In 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.
Corets, Eva
The Sundered Grail
Fantasy
5.95
2001-09-10
The two daughters of Maeve, half-sisters,
battle one another for control of England. Sequel to
Oberon's Legacy.
Randall, Cynthia
Lover Birds
Romance
4.95
2000-09-02
When Carla meets Paul at an ornithology
conference, tempers fly as feathers get ruffled.
Thurman, Paula
Splish Splash
Romance
4.95
2000-11-02
A deep sea diver finds true love twenty
thousand leagues beneath the sea.
Knorr, Stefan
Creepy Crawlies
Horror
4.95
2000-12-06
An anthology of horror stories about roaches,
centipedes, scorpions and other insects.
TitleAuthorGenrePublish DatePrice
Gambardella, Matthew
XML Developer's Guide
Computer
44.95
2000-10-01
An in-depth look at creating applications
with XML.
Ralls, Kim
Midnight Rain
Fantasy
5.95
2000-12-16
A former architect battles corporate zombies,
an evil sorceress, and her own childhood to become queen
of the world.
Corets, Eva
Maeve Ascendant
Fantasy
5.95
2000-11-17
After the collapse of a nanotechnology
society in England, the young survivors lay the
foundation for a new society.
Corets, Eva
Oberon's Legacy
Fantasy
5.95
2001-03-10
In 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.
Corets, Eva
The Sundered Grail
Fantasy
5.95
2001-09-10
The two daughters of Maeve, half-sisters,
battle one another for control of England. Sequel to
Oberon's Legacy.
Randall, Cynthia
Lover Birds
Romance
4.95
2000-09-02
When Carla meets Paul at an ornithology
conference, tempers fly as feathers get ruffled.
Thurman, Paula
Splish Splash
Romance
4.95
2000-11-02
A deep sea diver finds true love twenty
thousand leagues beneath the sea.
Knorr, Stefan
Creepy Crawlies
Horror
4.95
2000-12-06
An anthology of horror stories about roaches,
centipedes, scorpions and other insects.
TitleAuthorGenrePublish DatePrice
|
给你一个分页显示的模板程序
JSP例程 - 数据分页显示 -JDK1.2
0){
out.println(PageNum);//显示数据,此处只简单的显示页数
}
/*需要显示的数据,在此处显示
、、、
例如:
*/
//显示一个简单的表格
%>
总数
页数
第页 共页
下一页
1){%>上一页
JSP例程 - 数据分页显示 -JDK1.2
0){
out.println(PageNum);//显示数据,此处只简单的显示页数
}
/*需要显示的数据,在此处显示
、、、
例如:
*/
//显示一个简单的表格
%>
总数
页数
第页 共页
下一页
1){%>上一页
|
/**功能:显示下面一排的翻页链接导航条,以文字显示上一页和下一页链接,中间显示数字
*
* @param displayPages:中间显示的链接数;
* @return
*/
public String pagesArrange(int displayPages)
{
return pagesArrange("", "", displayPages);
}
/**功能:给出查询结果信息。模式为:共几条记录,第几页/共几页。
*
* @return
*/
public String getQueryInfo()
{
getMessage();
currentPageNum = (totalPages == 0)? 0:currentPageNum;
String queryInfo = "共" + totalRecord + "条记录,第" + currentPageNum + "页/共" + totalPages +"页";
return queryInfo;
}
/**功能:以二维数组返回所有结果。
*
* @return
*/
public String[][] getAllResult()
{
getMessage();
return resultArray;
}
/**功能:得到所有记录特定列的值。
*
* @param columnIndex:列索引号,从1开始。
* @return
*/
public String[] getSpecialColumn(int columnIndex)
{
getMessage();
String[] columnValue = null;
if(columnIndex >= 1 && columnIndex
*
* @param displayPages:中间显示的链接数;
* @return
*/
public String pagesArrange(int displayPages)
{
return pagesArrange("", "", displayPages);
}
/**功能:给出查询结果信息。模式为:共几条记录,第几页/共几页。
*
* @return
*/
public String getQueryInfo()
{
getMessage();
currentPageNum = (totalPages == 0)? 0:currentPageNum;
String queryInfo = "共" + totalRecord + "条记录,第" + currentPageNum + "页/共" + totalPages +"页";
return queryInfo;
}
/**功能:以二维数组返回所有结果。
*
* @return
*/
public String[][] getAllResult()
{
getMessage();
return resultArray;
}
/**功能:得到所有记录特定列的值。
*
* @param columnIndex:列索引号,从1开始。
* @return
*/
public String[] getSpecialColumn(int columnIndex)
{
getMessage();
String[] columnValue = null;
if(columnIndex >= 1 && columnIndex