Hi i’m using groovy & grails. trying to loop in a table. Getting error at start of g each
<table class='display'>
<tr>
<th>ID</th>
<th>NAME</th>
<th>IATA</th>
<th>STATE</th>
<th>COUNTRY</th>
</tr>
<g:each in="${airportsInstanceList}" var="book">
<tr>
<td>${airports.id}</td>
<td>${fieldValue(bean: airports, field: "name")}</td>
<td>${airports.iata}</td>
<td>${airports.state}</td>
<td>${airports.country}</td>
<!-- <td><g:link action="show" id="${airports.id}">details</g:link></td>-->
</tr>
</g:each>
</table>
The
varattribute is the name of the iteration variable. Change that frombooktoairports. Changingairportstoairportwould make more sense, too, although that’s just an issue of style.