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
"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.
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
Joined: Feb 06, 2001
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
subject: urgent urgent .....How do i do paging in JSP ?????