I have a JSP page with JSTL and I want to separate an user from other with an <hr>
tag. How can I solve it?
<c:forEach var="user" items="${list_users}">
<c:out value="${user.name}"/>
<c:out value="${user.surname}"/>
</foreach>
I have a JSP page with JSTL and I want to separate an user from other with an <hr>
tag. How can I solve it?
<c:forEach var="user" items="${list_users}">
<c:out value="${user.name}"/>
<c:out value="${user.surname}"/>
</foreach>
You can use a table to draw each user in the cell, then put <hr>
<table>
<c:forEach var="user" items="${list_users}">
<tr><td>
<c:out value="${user.name}"/><br>
<c:out value="${user.surname}"/><br>
<hr>
</td></tr>
</c:foreach>
</table>
Put it inside the loop and use varStatus
attribute of c:forEach
to remove the one line you don't need in the end.
<c:forEach var="user" items="${list_users}" varStatus="status">
<c:out value="${user.name}" />
<c:out value="${user.surname}" />
<c:if test="${not status.last}">
<hr />
</c:if>
</c:forEach>