• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

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

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"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.
 
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well you can store the records retrieved from the database into one of the collection classes. Now you can easily traverse through the records.
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 358
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic