Some of the Grails conventions for passing data from the controller to the view I find a bit opaque notwithstanding reading the documentation. A few basic questions:
Here are some questions:
1) in the scaffolding created for a 'Person' controller, the index action ends with
respond Person.list(params) model:[personCount: Person.count()]
In in index.gsp, the list is rendered to the browser using:
<f:table collection="${personList}" />
My question is, where did this personList variable come from? Or put another way, how did the output of Person.list(...) in the controller show up in the view with the name personList? Is there a generalizable rule about if you call
respond foo
and foo is a list, then it will show up in the controller under the name "fooList"?
2) If you can provide a object to the controller just by saying "render foo", what is the purpose of the model parameter? i.e. is there some difference between
respond foo
and
respond model:[foo: foo]
It seems like both would be accessible in the view using "${foo}"
3) Finally, what is a concise description of the difference between "respond" and "render"? They both seem to deliver data from the controller to the view.