my dog learned polymorphism
The moose likes JDBC and Relational Databases and the fly likes Paging JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Paging JSP" Watch "Paging JSP" New topic

Paging JSP

steps fors

Joined: Nov 16, 2003
Posts: 3
Hi please tell me how to do paging in JSP.The page number should be displayed Depending on the number of records[For example,if there are 25 records,only 3 pages should be displayed.10/page].
What i have done is
JSP code
int nPage=0;
int ShowRecordFrom =0;
int pageSize = 5;
ShowRecordFrom = nPage * pageSize;
sql="select * from TimeSheets order by ProjectId Asc limit "+ ShowRecordFrom +",5";

  <A HREF="TimeEmpget.jsp?nPage=0"><b>1</b></A>
  <A HREF="TimeEmpget.jsp?nPage=1"><b>2</b></A>
  <A HREF="TimeEmpget.jsp?nPage=2"><b>3</b></A>
  <A HREF="TimeEmpget.jsp?nPage=3"><b>4</b></A>
  <A HREF="TimeEmpget.jsp?nPage=4"><b>5</b></A>
Please give me the code for this..Thanks in advance.
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
(this is more appropriate in the JSP forum, have a look at
this link )

I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
I agree. Here's the link:
subject: Paging JSP
It's not a secret anymore!