How to Display table data as form
I m using following code for retrive record from table .
final List<List<Object>> resultTable = new ArrayList<List<Object>>();
int maxColumn = resultset.getMetaData().getColumnCount()+1;
while(resultset.next())
{
final List<Object> row = new ArrayList<Object>();
for(int colIndex = 1; colIndex < maxColumn ; colIndex++){
row.add(resultset.getObject(colIndex));
}
resultTable.add(Collections.unmodifiableList(row));
}
return resultTable
int maxColumn = resultset.getMetaData().getColumnCount()+1;
while(resultset.next())
{
final List<Object> row = new ArrayList<Object>();
for(int colIndex = 1; colIndex < maxColumn ; colIndex++){
row.add(resultset.getObject(colIndex));
}
resultTable.add(Collections.unmodifiableList(row));
}
return resultTable
it will retrieve only one row as per my query , but i want to display data as one cloumn . can any one help me please
Comments
If you have only one row you in your resultset you can do this :
int maxColumn = resultset.getMetaData().getColumnCount()+1;
while(resultset.next())
{
for(int colIndex = 1; colIndex < maxColumn ; colIndex++){
final List<Object> row = new ArrayList<Object>();
row.add(resultset.getObject(colIndex));
resultTable.add(Collections.unmodifiableList(row));
}
}
return resultTable;
Thanks for your ans , can you pl describe how to display . because . the code which you gave and i store data into javalist and on form take table and give initial value as that list. but still it shows one row with all cloumn.
i want to display one cloumn with multiple row. what i done wrong?
To do that I think you need to keep you first code and before the return you rotate your ArrayList<List
I don't know how to do that. Maybe you can find this on google.
ok thanks . any one pl can any one help me :(