table with object array data provider
hi!
i use the studio creator table and want to fill it with an object array data provider!
i have an array and the getter:
public TanData[] getTanDataArray()
{
return tanDataArray;
}
i choosed this for the data provider and in table layout i choose the dataprovider, but when i run my application there are no datas found although the array isn't empty!
[522 byte] By [
schaeflia] at [2007-11-27 5:01:17]

# 1
I know nothing about the Sun Studio Creator components, but for the JSF h:dataTable you can just wrap an ordinary object array in an [url=http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/javax/faces/model/ArrayDataModel.html]ArrayDataModel[/url]. You can also try to just convert the ordinary array to a List using List list = Arrays.asList(object[]) and pass it through that table.
# 3
maybe this is a problem:
i got my data from a database table and i store it in a vector.
in the example they have a class WeekBean and they fill their array with
WeekBean[] weeks = {
new WeekBean(1),
new WeekBean(2),
new WeekBean(3),
new WeekBean(4)
};
and i tried to do this:
private Vector<TanData> tanDataList = new Vector();
private TanData[] tanDataArray;
getTanDataList().copyInto(tanDataArray);
could it be that that isn't correct?
# 4
this works:
TanData[] tanDataArray = {
new TanData("1223", 33, 89),
new TanData("3333", 66, 102),
}
;
this does not work:
tanDataArray = new TanData[2];
tanDataArray[0] = new TanData("1223", 33, 89);
tanDataArray[1] = new TanData("3333", 66, 102);