How to print in a select in a jsp one list within another?

Asked

Viewed 22 times

0

<div align="center">
    <table border="1" cellpadding="5">
        <caption>
            <h2>Lista de Usuarios</h2>
        </caption>
        <tr>
            <th>CPF</th>
            <th>Nome</th>
            <th>Cargo</th>
            <th>Email</th>
            <th>Senha</th>
            <th>Sistemas</th>
            <th>Ações</th>
        </tr>
        <c:forEach var="u" items="${usuarios}">
            <tr>
                <td><c:out value="${u.cpf}" /></td>
                <td><c:out value="${u.nome}" /></td>
                <td><c:out value="${u.cargo.nome}" /></td>
                <td><c:out value="${u.email}" /></td>
                <td><c:out value="${u.senha}" /></td>
                <td><c:out value="${s.nome}" />-</td>
                <%-- <c:forEach var="s" items="${usuarios.sistemas}"> -> Não funciona
                    <td><c:out value="${s.nome}" />-</td>
                </c:forEach> --%>
                <td>
                    <a href="/edit?id=<c:out value='${u.cpf}' />">Editar</a>&nbsp;&nbsp;&nbsp;&nbsp; 
                    <a href="/delete?id=<c:out value='${u.cpf}' />">Apagar</a>
                </td>
            </tr>
        </c:forEach>
    </table>
</div>

Can anyone explain me how to print in the same select another list associated with the first list?

1 answer

0

I was able to solve it this way:

<div align="center">
    <table border="1" cellpadding="5">
        <caption>
            <h2>Lista de Usuarios</h2>
        </caption>
        <tr>
            <th>CPF</th>
            <th>Nome</th>
            <th>Cargo</th>
            <th>Email</th>
            <th>Senha</th>
            <th>Sistemas</th>
            <th>Ações</th>
        </tr>
        <c:forEach var="u" items="${usuarios}">
            <tr>
                <td><c:out value="${u.cpf}" /></td>
                <td><c:out value="${u.nome}" /></td>
                <td><c:out value="${u.cargo.nome}" /></td>
                <td><c:out value="${u.email}" /></td>
                <td><c:out value="${u.senha}" /></td>
                <td>
                    <c:forEach var="i" items= "${u.sistemas}">
                        <c:out value="${i.nome}"> &nbsp;&nbsp;</c:out>
                    </c:forEach>
                </td>
                <td>
                    <a href="/edit?id=<c:out value='${u.cpf}' />">Editar</a>&nbsp;&nbsp;&nbsp;&nbsp; 
                    <a href="/delete?id=<c:out value='${u.cpf}' />">Apagar</a>
                </td>
            </tr>
        </c:forEach>
    </table>
</div>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.