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.
次のクラスがあるとします
class Genre { static hasMany=[author:Author] } class Author{ static hasMany=[books:Books] } class Books{ Author author }
g:each タグを使用して gsp でこれを印刷するにはどうすればよいですか?
すべての本を著者別に表示したい場合は、次のようなものがあります
<g:each var="author" in="${Author.list()}"> <p>Author: ${author.fullName}</p> <ul> <g:each var="book" in="${author.books}"> <li>${book.title}</li> </g:each> </ul> </g:each>
乾杯!