views:

36

answers:

1

One of the things I liked about freemarker is that you can quickly create new macros that encapsulate complex html to make the pages smaller and more concise. Do I have to make tag libraries to do the same thing in grails, or is there a really light-weight syntax for achieving the same thing?

+3  A: 

There is a <g:render> tag, which may match your needs. It's documented here.

Daniel Engmann
yep - <g:render template="blah" /> is the Grails equivalent of partials
leebutts
where is "blah" stored? The current directory of the gsp? A special location? The documentation on this feature is actually really bad. Also, I don't really want to use them to pass variables and stuff. Well, I might... but actually, I just want to split up and reuse big html fragments. For some reason, with security, I can't.
egervari
You need a _blah.gsp (with underscore at the beginning of the filename) in the current directory. You can also put it in another directory. Then you must specify the relative path or absolute path from grails-app/views. When you have a _blah.gsp in the directory grails-app/views/templates the tag would look like <g:render template="/templates/blah"/>
Daniel Engmann