I want to display a table by retrieving values from an Arraylist in my JSP. This is the table section of the code from the JSP
<p> <table id="myTable"> <tr class="header"><% ArrayList arrColHead = new ArrayList(); arrColHead.add("Col Head 1"); rrColHead.add("Col Head 2"); for(int i=0; i < arrColHead.size(); i++) { %><th style="width:10%"><% arrColHead.get(i); %></th><% } %></tr> </table>
This does not display "Col Head 1" and "Col Head 2". What could possibly be wrong?
However, if I try to hard code the values, it shows the table properly.
for(int i=0; i < arrColHead.size(); i++){ %><th style="width:10%"> Col Head 1</th><%
}
I am new to J2EE programming. So any help here is appreciated