Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to Break the Jsp Page every 20 records  RSS feed

 
Kumar Naidu
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all


i am using JSP I have total 500 records but show all records at a time But i have only 20 records every time i can click the Next Button Next 20 Records Display How to Break the every 20 Records


Vinay
[ July 27, 2006: Message edited by: Kumar Naidu ]
 
Tauri Valor
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Each time when you click on "Next" iterate over 20 records...when you come out of the loop increment the counter with next record index, again it iterates in the loop until the last record is reached..

can be done storing the value 20 or 21 in the hidden field and submitting to the same page...using onclick event with a javascript method..
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look atValueListHandler Pattern

You might have to maintain the retrieved data into a list and on click of 'Next', you will have to display the relevant next 20 items.
The sequence diagram in the link, mentioned above, will help you in understanding this better.
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your data comes from a database, then some databases support retrieving data in terms of pages(i.e. pagination of ResultSet). In this case, you will not have to maintain the large amount of data in memory. Every click of 'Next' button can retrieve the next set of data from the paginated resultset.

However, if you are sure that the records are not going to exceed 500 or maybe some managable number, then you can go ahead and retrieve the entire set of data in one go.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the JSP FAQ for info on paging results.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!