File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Paging results Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Paging results" Watch "Paging results" New topic
Author

Paging results

Gus Winds
Greenhorn

Joined: Feb 04, 2003
Posts: 15
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

Joined: Jan 10, 2002
Posts: 61064
    
  66

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Wayne L Johnson
Ranch Hand

Joined: Sep 03, 2003
Posts: 399
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

Joined: Aug 01, 2002
Posts: 105
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.


Sanjeev Kaushik
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Paging results