Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
需要以表格形式显示列表。
var dispList = [["a","b","c"],["d","e","f"]]
尝试使用嵌套<g:each>标签,但没有成功。有什么建议么 ?
<g:each>
格式-
<table> <tr> <td>a</td> <td>b</td> <td>c</td> <tr> <tr> <td>c</td> <td>d</td> <td>e</td> <tr> </table>
嵌套<g:each>循环确实有效,但我通常发现我必须使用var属性而不是依赖默认的“it”变量名。如果您dispList在 GSP 模型中调用了一个变量,那么您可以这样做
var
dispList
<table> <g:each in="${dispList}" var="row"> <tr> <g:each in="${row}" var="val"> <td>${val}</td> </g:each> </tr> </g:each> </table>