File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

(How do i do paging in JSP ????? HELP ME >URGENT

 
Deepak B
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thru java server pages(JSP), 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) 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: MSSQL 7.0
Deepak
 
Divyajot Ahluwalia
Ranch Hand
Posts: 46
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi deepak,
i can suggest the following:
make a session object and store the existing page no ie 1,2,3,4
use this page number to query the database with limits clause
check the mysql documentation for details. u will get the page number from the session object. multiply the page number with 10 and add 1 so u get the start value. query the db with the start value and extract 10 records.
example of such a query is
SELECT * from tablename where 1 LIMIT 3, 10
here we are picking 10 records starting from the 3rd.
try it out and if any problem let me know
rgds
dj
 
Raghav Sam
Ranch Hand
Posts: 412
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi deepak,
normally the procedure will be to store the records returned in a Vector and iterate as required. but since your record size is huge, the best solution i would imagine is filter the records to a size of 10 at the database level itself, store it in a Vector and display. use a Servlet to do this and have it pass the Vector object to the JSP page.
hope this helps,
raghav.
 
Deepak B
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello Divyajot
Thnx for help , i really need help for execute record page by page , But solution your are talking That Used MySQL Database ,t I tried maney ResultSet Methods doesn't work with MS SQL 7.0, like as u said
/******************************
SELECT * from tablename where 1 LIMIT 3, 10
here we are picking 10 records starting from the 3rd.
/********************************************
This dosen't work with MSSQL 7.0 so can u give me any other solution for this

Thnx
Deepak

 
Julia Reynolds
Ranch Hand
Posts: 123
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out this custom tag at jsptags.com:
http://jsptags.com/tags/navigation/pager/
Julia
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic