small medium large xlarge

Back to: All Forums  Grails
Dklein_tiny_pragsmall
16 Aug 2009, 04:29
Dave Klein (34 posts)

The first post in the GQuick blog is on how to display an image in a GSP. Specifically we’ll cover how to display the Sponsor logo property in the Sponsor show page. The technique can be used to display any image stored as a domain class property on any GSP though.

I hope it is helpful, Dave

Dklein_tiny_pragsmall
17 Aug 2009, 02:13
Dave Klein (34 posts)

Sorry, forgot the link. http://gquick.blogspot.com

Fotofoletto_pragsmall
13 Sep 2009, 18:39
Paolo Foletto (1 post)

I’m able to use this tecnique to display an image in a GSP. The logo is nillable, so if there is the logo I’m able to show the logo, but if the logo is null, I get an error on the console and a broken image on the page. How I can display nothing if the logo is null?

Dklein_tiny_pragsmall
14 Sep 2009, 17:18
Dave Klein (34 posts)

Paolo,

Good question. The quick fix would be to wrap the tag in the show view with a tag. Something like this:

Perhaps a better solution would be to create a custom tag. This might a future entry at gquick.blogspot.com

Thanks, Dave

You must be logged in to comment