Discussion:
binding both params and request body to command objects
Clifton McIntosh
2014-03-26 19:45:02 UTC
Permalink
With Grails 2.3.7's binding request bodies to command objects, it does not
seem that params (in the url) can also be bound to the same command. Does
anyone have a suggestion for how this might be done?

Given a url mapping like "/api/$customerId/sign" can I also have
$customerId bound to a command object that is also binding to the request
body?

Here is an example command object with the customerId in which I would like
the customerId field to be bound to the param yet have the rest of the
values be bound to the request body:

SignatureCommand {
String customerId
List<String> esign
List<String> esignConfirm
Boolean attested
}
BrianK
2014-05-23 16:18:19 UTC
Permalink
Just had this problem with 2.3.7

The solution was to provide a URL mapping in UrlMappings.groovy

"/customers/${id}/addresses"(resources: "address")

It may also be advisable to run "grails url-mappings-report" to check what
variable name to use.



--
View this message in context: http://grails.1312388.n4.nabble.com/binding-both-params-and-request-body-to-command-objects-tp4655453p4657008.html
Sent from the Grails - user mailing list archive at Nabble.com.

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

http://xircles.codehaus.org/manage_email

Continue reading on narkive:
Search results for 'binding both params and request body to command objects' (Questions and Answers)
12
replies
why is montheism important and how did it develop?
started 2007-10-19 21:31:38 UTC
history
Loading...