How to Display table data as form

1
0
-1

I m using following code for retrive record from table .

  1. final List<List<Object>> resultTable = new ArrayList<List<Object>>();
  2. int maxColumn = resultset.getMetaData().getColumnCount()+1;
  3. while(resultset.next())
  4. {
  5.  
  6. final List<Object> row = new ArrayList<Object>();
  7. for(int colIndex = 1; colIndex < maxColumn ; colIndex++){
  8. row.add(resultset.getObject(colIndex));
  9. }
  10. resultTable.add(Collections.unmodifiableList(row));
  11.  
  12. }
  13. 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 :

  1. final List<List<Object>> resultTable = new ArrayList<List<Object>>();
  2. int maxColumn = resultset.getMetaData().getColumnCount()+1;
  3. while(resultset.next())
  4. {
  5.  
  6. for(int colIndex = 1; colIndex < maxColumn ; colIndex++){
  7. final List<Object> row = new ArrayList<Object>();
  8. row.add(resultset.getObject(colIndex));
  9. resultTable.add(Collections.unmodifiableList(row));
  10. }
  11.  
  12. }
  13. 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