I have an arraList inside a javascript.I want to get that arrayList to iterate inside html <c:forEach>.How can I do this. I can get this arrayList to a <h:outputText> but I want to iterate the list.
My javascript arraList is like this
<script>
topCategory = new Array();
topCategory.push("one");
topCategory.push("two");
topCategory.push("threee");
topCategory.push("four");
</script>
I need to iterate this topCategory inside a html <c:forEach>
for ex:
<script>
topCategory = new Array();
topCategory.push("one");
topCategory.push("two");
topCategory.push("threee");
topCategory.push("four");
then this list should be iterated inside a
<table width="100%">
<tr>
<td rowspan="2" width="20%">
<c:forEach items="#{topCategory}" var="cat">
<p:commandButton value="#{cat}"/>
</c:forEach>
</td>
</tr>
<c:forEach>, write one.<c:forEach>is from the JSP standard tag library, used to iterate Java arrays, collections, etc.<c:forEach>I need to pass that arrayList tohtml.I want to know how to do that.I do not want to add a<c:forEach>inside the javascript. I need to pass the topCategory arrayList ïnsidehtmllike ` <c:forEach item="topCategory " ..`