How do Grails Controller action arguments work when the arg is a Domain class instance?

18 views
Skip to first unread message

Matt Lachman

unread,
Oct 2, 2017, 3:13:46 PM10/2/17
to Grails Dev Discuss
Hi Grails Community,

It's been several years since my last post in here. Does anyone have insight into how Domain objects as Controller action arguments are data-bound? I posted this on SO too, with a little more detail: https://stackoverflow.com/questions/46532091/grails-3-3-1-controller-action-with-domain-object-argument-how-is-data-bound

Any help would be great. Eventually I would like to implement a editIfExistsElseCreate type action, so knowing how this works would be ideal.

Matt Lachman

Jeff Scott Brown

unread,
Oct 2, 2017, 4:46:56 PM10/2/17
to Grails Dev Discuss
The default implementation already does an editIfExistsElseCreate kind
of thing. This is described under “Using Command Objects” at
http://docs.grails.org/latest/guide/theWebLayer.html#commandObjects.

I also left an answer at StackOverflow which shows some pseudocode which
describes a lot of what is going on.




JSB
--
Jeff Scott Brown
OCI Grails Practice Lead
Principal Software Engineer

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/

Matt Lachman

unread,
Oct 3, 2017, 9:43:54 AM10/3/17
to grails-de...@googlegroups.com
Thanks for the link and the SO answer. That was the information I was having a hard time finding yesterday.

--
You received this message because you are subscribed to a topic in the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/grails-dev-discuss/JKvCk86S5Wc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to grails-dev-disc...@googlegroups.com.
To post to this group, send email to grails-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/2004E9B5-0EF7-49D5-BCFE-5F35D01261FD%40objectcomputing.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages