Relatioships between actions, controllers and views - how to sort it out?


New member

I've been playing with Grails for a bit now and in spite of reading the documentation and searching online, I'm kind of stuck on how to do the following:

Consider 3 domain classes, each with its own controller, actions and view.
Domain 3 has a couple of attributes which should be dependant of the other 2 domains.
When using the Create action for domain 3, the view form should include drop-down lists for those couple attributes, and the dropdown lists should be populated with data from domains 1 and 2.

What is the best way of doing this? I've read about chains and redirects, and there is also the possibility of working the view in domain 3 and include select code thereto obtain info fromdomains 1 and 2.

It would seem cleaner to me though if the view were to beleft alone in terms of logic, and that the controllers and actions themselves would relate.

Can anyone help, I hope I have managed to properly lay it thesituation.


New member

knowing fully well that maybe my question wasn't very well laid out to begin with, I've managed to solve it using Relationships and Scaffolding.

I bought this book:

Groovy and Grails Recipes
ISBN13: 978-1-4302-1600-1

And I managed to set relationships with "belongTo" in the controllers and link them so that the automatically generated views produce dropdown-lists pre-populated with objects from the related domain class.