I\'m a newbie on grails. I am now currently working on my scaffolding templates especially on my controllers. I wanted a customized controller everytime I generate it so I used
edit.gsp, show.gsp and list.gsp templates all have logic for creating fields basing on domain class, you can see there how it's done.
Basically, when you include groovy code in your template, you can access domain class by using domainClass variable, and then you can print properties declarations by iterating over array returned by getProperties(), like this:
<%
domainClass.properties.each {
println " ${it.type} ${it.name}"
}
%>