This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Services and the fly likes Collection manipulation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Collection manipulation" Watch "Collection manipulation" New topic
Author

Collection manipulation

AshishP Gandhi
Greenhorn

Joined: Aug 05, 2007
Posts: 9
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.


Regards,
Ashish.
Ronald Aguilar
Greenhorn

Joined: Sep 14, 2004
Posts: 21
try a JSF dataScroller. it will take you 5 minute to implement.


Ron
Suryavas.k Kazipeta
Greenhorn

Joined: Nov 24, 2008
Posts: 3
Hi,

Implementing java.util.Collections is possible in WebServices using @XmlJavaTypeAdapter (JAXB 2.0).
have a look on below link and example
https://jaxb.dev.java.net/guide/XML_layout_and_in_memory_data_layout.html

@XmlRootElement
class ComplexStruct {
@XmlJavaTypeAdapter(value=ArrayListDataAdapter.class)
@XmlElement
ArrayList<Data> dataList;
}

class ArrayListDataAdapter extends XmlAdapter<Data[], ArrayList<Data>> {

@Override
public ArrayList<Data> unmarshal(Data[] objectArray2ArrayList) {
if ( objectArray2ArrayList == null )
return null;

return new ArrayList<Data>(Arrays.asList(objectArray2ArrayList));
}
@Override
public Data[] marshal(ArrayList<Data> arrayList2ObjectArray) {
if ( arrayList2ObjectArray == null )
return null;

Data[] dataArray = new Data[ arrayList2ObjectArray.size() ];
int i=0;
for (Data data : arrayList2ObjectArray) {
dataArray [ i++ ] = data;
}
return dataArray;
}
}

regards,
Surya.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Collection manipulation
 
Similar Threads
I do not know
Collections / Generics
B&S:On the class Data
Records In Collection Object
Collection manipulation