可能重复:
Grails:在 gsp 中显示创建的图像
我正在尝试在<g:each>
标签中显示数据库中的图像。
我的域类:
class Artists {
byte[] image
String artistName
String bio
static constraints = {
image(nullable:true , maxSize:200000)
artistName(nullable:true)
bio(nullable:true, maxSize:2000)
}
}
和艺术家.gsp:
<g:each in="${dog.Artists.list()}">
<g:img src="${it.image }" width="120" height="160"/> //doesn't work, what should I do here???
<p>Name: ${it.artistName}</p> //works
<p>Biography: ${it.bio}</p> //works
</g:each>
请帮忙 !!!