# How to Display table data as form

**URL:** <https://community.ofelia.com/t/how-to-display-table-data-as-form/4940>\
**Category:** Q&A\
**Created:** [4 August 2014 11:30 UTC](https://community.ofelia.com/t/how-to-display-table-data-as-form/4940 "2014-08-04T11:30:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![er.erikndp](https://avatars.discourse-cdn.com/v4/letter/e/b2d939/32.png) [@er.erikndp](https://community.ofelia.com/u/er.erikndp)\
**Post date:** [4 August 2014 11:30 UTC](https://community.ofelia.com/t/how-to-display-table-data-as-form/4940/1 "2014-08-04T11:30:39Z")

</div>

I m using following code for retrive record from table .

`
final List<List> resultTable = new ArrayList<List>();
int maxColumn = resultset.getMetaData().getColumnCount()+1;
while(resultset.next())
{
final List row = new ArrayList();
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

---

<div class="post-metadata">

**Author:** ![asad.shakeel\_1381337](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@asad.shakeel\_1381337](https://community.ofelia.com/u/asad.shakeel_1381337)\
**Post date:** [16 October 2018 06:01 UTC](https://community.ofelia.com/t/how-to-display-table-data-as-form/4940/2 "2018-10-16T06:01:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![yannick.lombardi](https://avatars.discourse-cdn.com/v4/letter/y/8e8cbc/32.png) [@yannick.lombardi](https://community.ofelia.com/u/yannick.lombardi)\
**Post date:** [4 August 2014 12:24 UTC](https://community.ofelia.com/t/how-to-display-table-data-as-form/4940/3 "2014-08-04T12:24:53Z")

</div>

If you have only one row you in your resultset you can do this :  
  
final List\<List\> resultTable = new ArrayList\<List\>();  
int maxColumn = resultset.getMetaData().getColumnCount()+1;  
while(resultset.next())  
{

for(int colIndex = 1; colIndex \< maxColumn ; colIndex++){  
final List row = new ArrayList();  
row.add(resultset.getObject(colIndex));  
resultTable.add(Collections.unmodifiableList(row));  
}

}  
return resultTable;

---

<div class="post-metadata">

**Author:** ![er.erikndp](https://avatars.discourse-cdn.com/v4/letter/e/b2d939/32.png) [@er.erikndp](https://community.ofelia.com/u/er.erikndp)\
**Post date:** [5 August 2014 04:51 UTC](https://community.ofelia.com/t/how-to-display-table-data-as-form/4940/4 "2014-08-05T04:51:02Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![yannick.lombardi](https://avatars.discourse-cdn.com/v4/letter/y/8e8cbc/32.png) [@yannick.lombardi](https://community.ofelia.com/u/yannick.lombardi)\
**Post date:** [5 August 2014 07:48 UTC](https://community.ofelia.com/t/how-to-display-table-data-as-form/4940/5 "2014-08-05T07:48:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![er.erikndp](https://avatars.discourse-cdn.com/v4/letter/e/b2d939/32.png) [@er.erikndp](https://community.ofelia.com/u/er.erikndp)\
**Post date:** [5 August 2014 10:18 UTC](https://community.ofelia.com/t/how-to-display-table-data-as-form/4940/6 "2014-08-05T10:18:28Z")

</div>

ok thanks .  
any one pl can any one help me ☹
