Reputation: 81
<table>
<c:forEach var="moviesFromAGenre" items="${moviesFromRandomGenres}">
<tr>
<c:forEach var="movie" items="${moviesFromAGenre}">
<td>
<a href="getMovie?selected=<c:out value="${movie[0]}"/>" >
<img src="<c:out value="${movie[1]}"/>" WIDTH="200" HEIGHT="300" BORDER="0"/>
</a>
</td>
</c:forEach>
</tr>
</c:forEach>
</table>
The content is displaying like this:
1
2
3
4
5
...
Instead of:
1 2 3 4 5
5 6 7 8 9
I've tried using < br> after the first forEach and it produces the same result.
Upvotes: 0
Views: 731
Reputation: 219
Try this.
<c:forEach var="moviesFromAGenre" items="${moviesFromRandomGenres}">
<h:panelGrid columns="${moviesFromAGenre.size()}">
<c:forEach var="movie" items="${moviesFromAGenre}">
<a href="getMovie?selected=<c:out value="${movie[0]}"/>" >
<img src="<c:out value="${movie[1]}"/>" WIDTH="200" HEIGHT="300" BORDER="0"/>
</a>
</c:forEach>
</h:panelGrid>
</c:forEach>
Upvotes: 0
Reputation: 44834
You do not want to use <br>
as you are using a <table>
this can be formatted to your requirements by changing the positioning of <tr>
Use Browser development tools to inspect the html that is generated
Upvotes: 1