Reputation: 970
I'm trying to print out a list of names and i want to be the one down to another I'm trying this code:
<tr>
<td> Names: </td>
<td>
<c:forEach items="${names}" var="allnames">
<c:out value="${allnames} " ></c:out>
</c:forEach>
</td>
</tr>
But it print the one next to the other. What should i change?
P.S: the result now is: Names: nick george john and i want to be :
Names: nick
george
john
Upvotes: 0
Views: 814
Reputation: 2767
Use tag
Names:
<td>
<c:forEach items="${names}" var="allnames">
<br/>
<c:out value="${allnames} " ></c:out>
</c:forEach>
</td>
</tr>
Upvotes: 4
Reputation: 1704
<td>
<tr> Names: </tr>
<tr>
<c:forEach items="${names}" var="allnames">
<c:out value="${allnames} " ></c:out>
</c:forEach>
</tr>
</td>
Upvotes: 0
Reputation: 24002
Add <br/>
next to <c:out>
:
<c:out value="${allnames} " ></c:out> <br/>
Upvotes: 1
Reputation: 3967
Adding a <br/>
after each name will print a new line
<tr>
<td> Names: </td>
<td>
<c:forEach items="${names}" var="allnames">
<c:out value="${allnames} " ></c:out>
<br/>
</c:forEach>
</td>
</tr>
or you can include the <td>
tags in your forEach (I'm not quite sure that this will work!)
Upvotes: 2