Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Paging JSP

 
steps fors
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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;
pageNo=request.getParameter("nPage");
if(pageNo!=null)
{
if(!pageNo.equals(""))
{
nPage=Integer.parseInt(pageNo);
}
}
ShowRecordFrom = nPage * pageSize;
sql="select * from TimeSheets order by ProjectId Asc limit "+ ShowRecordFrom +",5";

HTML
<html>
<body>
<b>Page:</b>
  <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>
</body>
</html>
Please give me the code for this..Thanks in advance.
sryharee@yahoo.co.in
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(this is more appropriate in the JSP forum, have a look at
this link )
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic