I'm starting my studies in jsp and I came across the following situation: I want to use the forEach of jstl c: foreach and 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 this $ {dao.findAllContacts} is my DAO method that returns a list of contact objects. However, jsp thinks that findAllContacts is a property when in fact it is a method. How do you get around this problem? Thank you in advance.