Referencing entire model in grails view?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Referencing entire model in grails view?

netbrain


If i have a controller that returns the model [status:200, text:'oh yes'],
is there any way i can fetch the model in it's entirety in the view?

eg. instead of doing ${status} and ${text} im looking for a model accessor
which gives me the ability to do ${model.text} and ${model.status}

Possible or not?

- Kim
Reply | Threaded
Open this post in threaded view
|

Re: Referencing entire model in grails view?

Ian Roberts
On 11/01/2012 10:29, Kim Eik wrote:
>
>
> If i have a controller that returns the model [status:200, text:'oh yes'],
> is there any way i can fetch the model in it's entirety in the view?
>
> eg. instead of doing ${status} and ${text} im looking for a model accessor
> which gives me the ability to do ${model.text} and ${model.status}
>
> Possible or not?

pageScope.variables may give you what you're after, though that may
include other page variables (e.g. ones you created with <g:set>) in
addition to the ones in the original model.

Alternatively, change the way you pass in the model

[myModel:[status:200, text:'oh yes']]

Ian

--
Ian Roberts               | Department of Computer Science
[hidden email]  | University of Sheffield, UK

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email