• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Paging JSP

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(this is more appropriate in the JSP forum, have a look at
this link )
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic