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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
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: 6920
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.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How can i display some records from table in a page