How to display values in table in jsp?

java, javascript, jsp, jstl

Solution

This is not that difficult. The solution can be arrived at with an implementation like this :

<table>
<%
for ( int i =0; i < timeSize ; i++)
{
out.println(resource[i]);
out.println(itimespend[i]);
out.println(icostspend[i]);
totalcost += itimespend[i] * icostspend[i];     
%>

<tr>
<td> <%=resource[i]%></td>
<td><%=itimespend[i]%> </td>
<td> <%=icostspend[i]%></td>
</tr>

<%       
}
%>

</table>

Keep the table tag out side so as not to loop it every time and create a different table with every loop. This has not been tested, but I think you will get the basic idea from this one .

Problem

i am new to jsp and jstl i am working on this code to get the values from array using the for loop.i am getting the output, but i want to put that output into table.how to do this can anyone help me? ``` for ( int i =0; i < timeSize ; i++) { out.println(resource[i]); out.println(itimespend[i]); out.println(icostspend[i]); totalcost += itimespend[i] * icostspend[i]; } ```

Original source