我还在学习Grails,似乎遇到了绊脚石.
以下是2个域类:
class Photo { byte[] file static belongsTo = Profile } class Profile { String fullName Set photos static hasMany = [photos:Photo] }
相关的控制器代码段:
class PhotoController { def viewImage = { def photo = Photo.get( params.id ) byte[] image = photo.file response.outputStream << image } }
最后是GSP片段:
现在我如何访问照片以便它将显示在GSP上?我很确定这
profileInstance.photos.get(1).id
是不正确的.