I have the following bit in a controller:
def myJSON = [
'form' : g.render(template: '/information/form', model:informationInstance)
]
render myJSON as JSON
… and wonder what’s the difference between and purpose of render() and g.render()??
And where does ‘g‘ come from?
The g is the namespace for the Grails tag library. It is automatically injected into controllers and views. In a controller, you access it as g.XXX() rather than
<g:XXX />. There really is no difference in how they function under the covers except with how the controller triggers its response.