How to Display table data as form

1
0
-1

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

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

Submitted by yannick.lombardi on Mon, 08/04/2014 - 14:24

If you have only one row you in your resultset you can do this :

final List<List<Object>> resultTable = new ArrayList<List<Object>>();
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;
Submitted by er.erikndp@gmail.com on Tue, 08/05/2014 - 06:51

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?

Submitted by yannick.lombardi on Tue, 08/05/2014 - 09:48

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.

Submitted by er.erikndp@gmail.com on Tue, 08/05/2014 - 12:18

ok thanks . any one pl can any one help me :(

1 answer

1
0
-1

Where to write the query and get the result set?
Also, do you have an answer to this question?

Notifications