<%
CounterGroup nonRepeated = new CounterGroup();
%>
<c:forEach var="tipoEntry" items="${documentosBean}">
<tr>
<td width="60"><c:out value="${tipoEntry.codigo}" /></td>
<td width="60"><c:out value="${tipoEntry.version}" /></td>
<td width="250"><c:out value="${tipoEntry.nombreDocumento}" />
</td>
<td width="250"><c:out value="${tipoEntry.tipo}" /></td>
</tr>
<%
nonRepeated.addItem(((DocumentoBean) pageContext
.getAttribute("tipoEntry")).getTipo());
%>
</c:forEach>
<%
pageContext.setAttribute("groupedKeys", nonRepeated.keySet());
%>
</table>
<table border="1" class="table">
<c:forEach var="key" items="${groupedKeys}">
<tr>
<td width="250"><c:out value="${key}" /></td>
<td width="250">
<%
out.print(nonRepeated.get(pageContext.getAttribute("key")));
%>
</td>
</tr>
</c:forEach>
No es una buena práctica ni se recomienda manejar así la visualización en los JSP pero para casos legacy es bueno tenerlo a mano.
No hay comentarios:
Publicar un comentario