0
I’m starting my jsp studies and came across the following situation: I want to use jstl foreach c:foreach and I want to use a list that is returned by my DAO method.
<body>
<jsp:useBean id="dao" class="teste.ContatoDAO"/>
<table>
<tr>
<th>Nome</th>
<th>Email</th>
<th>Endereco</th>
</tr>
<c:forEach var="contato" items="${dao.findAllContatos}">
<tr>
<td>${contato.nome}</td>
<td>${contato.endereco}</td>
<td>${contato.email}</td>
</tr>
</c:forEach>
</table>
Where that ${dao.findAllContacts} is my DAO method that returns a contact object list. However, jsp thinks findAllContacts is a property when it is actually a method. How to get around this problem? Thank you in advance.
Hi buddy, have you tried treating as method? Type:
dao.findAllContatos()
.– Andrew Ribeiro