aspose file tools*
The moose likes JDBC and the fly likes urgent urgent .....How do i do paging in JSP ????? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "urgent urgent .....How do i do paging in JSP ?????" Watch "urgent urgent .....How do i do paging in JSP ?????" New topic
Author

urgent urgent .....How do i do paging in JSP ?????

DeepakB
Greenhorn

Joined: Jun 19, 2001
Posts: 7
thru JSP, i want to display nearly 100 OR MORE THEN THAT records. in the first page it has first 10 records, next page has next 10 records and so on.. page: 1 2 3 4 5 6 7 8 9 10 (page no) when i select 1, it will show 1st page of first 10 records,if i select 2 it will show 2nd page of records starts from 11 to records 20 ... and so on.....
my back end is: MS SQL 7.0
DEEPAK
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
"DeepakB",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
rani bedi
Ranch Hand

Joined: Feb 06, 2001
Posts: 358
well you can store the records retrieved from the database into one of the collection classes. Now you can easily traverse through the records.


Cheers,<br />Rani<br />SCJP, SCWCD, SCBCD
Deepak B
Greenhorn

Joined: Jun 19, 2001
Posts: 17
Thnx parmeet
but , its huge database ,may be 500000 or more record, i want to display records. in the first page it has first 10 records, next page has next 10 records and so on.. page: 1 2 3 4 5 6 7 8 9 10 (page no)
Note : Data base is growing 1000 record every day so not possible to used any of collection or vector java class..
is there any method which directly retrive data from table and through java code in JSP page , i can divide that in to 10 record per page .

Thnx in advance
Deepak
rani bedi
Ranch Hand

Joined: Feb 06, 2001
Posts: 358
1. Put the entire result set into a collection of some kind ( array, or any collection object from java.util). If the rows of your query can be represented as objects, then create an object for each one and store the collection of objects as an ArrayList. Put the collection into the users's session, like this: session.setAttribute( "pageResults", myCollection );
2. create a page that displays the first N objects in your collection.
3. create a forward and backward links in your page that are numbered, with each number corresponding to N items in your collection. For example, if N=20 and page number is 0, you display the first 20 items; if page number is 1, you display items 21-40, etc. Of course if you're on the first or last page the backward and forward links should be disabled, respectively.
4. create an OutofMemory Error if result set is large
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: urgent urgent .....How do i do paging in JSP ?????