g:每个在一个表格中 [英] g:each in a table

查看:142
本文介绍了g:每个在一个表格中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好我正在使用groovy& Grails的。试图在表中循环。每次开始时都会出现错误

 < table class ='display'> 
< tr>
< th> ID< / th>
< th> NAME< / th>
IATA< / th>
STATE< / th>
< th> COUNTRY< / th>

< / tr>

< g:每个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 =showid =$ {airports.id}>详情< / g:link>< / td> - > ;

< / tr>
< / g:每个>
< / table>


解决方案

var 属性是迭代变量的名称。将它从 book 更改为 airports 。更改机场机场也会更有意义,不过这只是一个风格问题。


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 var attribute is the name of the iteration variable. Change that from book to airports. Changing airports to airport would make more sense, too, although that's just an issue of style.

这篇关于g:每个在一个表格中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆