File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Paging JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Paging JSP" Watch "Paging JSP" New topic
Author

Paging JSP

steps fors
Greenhorn

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;
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

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: http://aspose.com/file-tools
 
subject: Paging JSP