File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes How can i display some records from table in a page Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "How can i display some records from table in a page" Watch "How can i display some records from table in a page" New topic
Author

How can i display some records from table in a page

Vimal Gandhi
Greenhorn

Joined: Nov 29, 2000
Posts: 9
Hello advisers
I want to display records from a particular table in SQL server. If I have thousands of record then i want to display 20 records per page.
What is feasible solution among following.
1) I fire one qurey which fetch all data from it and then i store it in a ArrayList or Vector object & then display.
2) I fire query and fetch only 20 record by "select top 20 from table where rec_id > 0" for first time , next time condition will be rec_id > 20", That way i can get limited 20 rows from table (This is only possible in case of rec_id is a field in table) Now anyone tell me which is feasible.
Thanks in advance
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6913
Either is feasible. And there are other options, too.
3) Retrieve several pages-worth at once, so that the next few requests will be quicker, but you won't fill up your computer's memory. This is particularly effective on search-engine type applications, where very few people bother with more than the first few pages.
4) Think a bit more about why you need to retrieve "thousands" of records. Is anyone really going to page through all of them 20 at a time, or should you offer smarter selection so they can find just the ones they want to see.


A Convergent Visionary ~ Frank's Punchbarrel Blog ~ LinkedIn profile
 
 
subject: How can i display some records from table in a page
 
Threads others viewed
Pagination using the database(DB2)
Problem with JTable
Record Navigation
how to use NEXT and Previous
Retreiving 20 rows per page
MyEclipse, The Clear Choice

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture