Forums Register Login

Collection manipulation

+Pie Number of slices to send: Send
I need to take some records and display it on a jsp...and manipulate them like sorting / pagination
These records come through webservice.

Can you guide how should I go about it?

Can I make a class and get all data in collection and manipulate it the class when jsp page asks for sorting which is a button?

Awaiting replies.
+Pie Number of slices to send: Send
Have a look at the java.util.Collections class. It has methods for sorting lists.
+Pie Number of slices to send: Send
Can you please be a little more specific..
I am not getting how to do it??
+Pie Number of slices to send: Send
I'm going to move this to our Java in General (Beginner) forum because it's not really a JSP specific question.
+Pie Number of slices to send: Send
Have a look at the API Doc for the List interface. It includes a list of all standard classes that implement this interface. Select the most appropriate one for your needs (or write your own).

Once you have chosen your class, create an instance of it and then add your data to it.

You can then use the Collections.sort() methods to sort the data. Your data class will either have to implement the Comparable interface or you will have to use the version of Collections.sort() that accepts a Comparator instance.
[ August 09, 2007: Message edited by: Joanne Neal ]
I didn't say it. I'm just telling you what this tiny ad said.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 862 times.
Similar Threads
I do not know
B&S:On the class Data
Collection manipulation
Records In Collection Object
Collections / Generics
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 15:45:40.