• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Paging results

 
Gus Winds
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am receiving a collection of objects which i want to show ten items per page. I am displaying pages "1 2 3 .. " depending upon the number of pages i need. Since i have obtained the whole collection ( i know my volume doesnt exceed more than 100 objs for the app so i am getting all of them together ), i want to display different pages Without the server reloading the page. Is there any way i can do that ? I want to avoid going back to server and getting the objs again and again every time i click on a different page number.
thx
Gurmeet Singh.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64717
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Search through this forum and the Servlets forum for 'paging' and related terms and you'll find that this very subject has been discussed on numerous occasions with varied and helpful answers.
hth,
bear
 
Wayne L Johnson
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Keep in mind that even if you are storing all of the records (via a bean or HttpSession) on the server side, all you are sending back to the client is HTML. Once it gets back to the browser, you only have *dumb* representation of the data (in tables, etc.)
The standard way of handling this is to go back to the server. You can have either a single form (in which case the page numbers can call a JavaScript function that set a page parameter and does a .submit()) or you can have multiple forms, each of which sends the form data back to a JSP or servlet.
The only other way to do this, and it could get ugly, is to put all of the data for each object into hidden fields, and then use JavaScript to display the correct data. I think this is really the only way to handle it on the client side.
 
Sanjeev Kaushik
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can attempt this kind of approach. Generate all the results and assign the result in a variable corresponding to your number of pages.
you can get guided by the following example.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic