1

This is the current code i am trying to use. I was looking up online and <% and %> escape in order to use something like a for loop. So far <% is just printed on the page.

out.print("<table border = \"1\"> <%for(int i = 0; i < l; i++) { <tr><th>i</th></tr> }%>");
Renuz
  • 1,587
  • 7
  • 21
  • 34

1 Answers1

1

you can use c:forEach.You can try something like this

<table>
    <c:forEach var="item" items="${itemList}">
        <tr>
            <td>${item}</td>
        </tr>
    </c:forEach>
</table>

See Also

Community
  • 1
  • 1
RockAndRoll
  • 2,247
  • 2
  • 16
  • 35
  • I have tried that, nothing works. Do i need to import anything? Also this is being uploaded onto a web server and displayed, will it work just like that? – Renuz Oct 23 '15 at 03:41
  • you need to use jstl library to make it work.See http://stackoverflow.com/questions/1521257/getting-jstl-to-run-within-tomcat-and-eclipse – RockAndRoll Oct 23 '15 at 05:10