Putting Array Values into a Table
I have two ArrayList I would like to put these into a table with Arrylist one populating column one and ArrayList populating column two. I am using JSP.
I have two ArrayList I would like to put these into a table with Arrylist one populating column one and ArrayList populating column two. I am using JSP.
assuming both arrays are the same size:
try something like this:
<table>
<%for int ii=0;arrayList1.size();++ii){ %>
<tr>
<td>
<%=(String)arrayList1.get(ii)%>
</td>
<td>
<%=(String)arrayList2.get(ii)%>
</td>
</tr>
<%}%>
</table>
The above example is crude and may not compile,but you get the idea.
just for the record (no pun intended), typically you do tables in record/row format where an ArrayList is the table and each item in the ArrayList would represent a row in the form of some object and each member variable of that object is a column. sorry if that doesn't fit with the discussion, just thought i'd add that