It turned out the solution:
<c:set var="index" value="${0}"></c:set>
<c:forEach items="${searchResults}" var="contact">
<div style="padding: 5px;">
${contact.firstName} ${contact.lastName}
<br>
${contact.primaryPhone}
<br>
${index}
</div>
<c:set var="index" value="${index+1}"></c:set>
</c:forEach>
If someone knows a more elegant approach, I would be happy to see him.
source
share