Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails and gsp: How to render nested template with the same model/bean?

maybe I am just asking google & co. the wrong questions but this is what I want to accomplish:

I have a GSP template with a nested template within. The outer one has access to the members of a domain class instance. Instead of passing all the domain member like

<g:render template="/image/alternativeTemplate" model="${[member1: member1, member2: member2]}"/>

or using the iterator like

<g:render template="/image/alternativeTemplate" model="${[it: it]}"/>

i would like to do simply use outer GSP's model in the inner one.

Am I missing something?

Greetings, smon

like image 759
smon Avatar asked Mar 11 '14 11:03

smon


1 Answers

To expose the entire model to a template for rendering use pageScope.variables such as:

<g:render template="/some/template" model="${pageScope.variables}"/>
like image 116
Joshua Moore Avatar answered Sep 26 '22 06:09

Joshua Moore