Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails data binding- command objects with Maps

Grails 2.0.3 I am having problem with binding the data to command objects. I have the jquery request like this http://localhost:8080/api/test.json?callback=jQuery17102313091890902648_1334273415631&ex[0][a]=a0&ex[0][b]=b0&ex[1][a]=a1&ex[1][b]=b1

I need a way of binding the data from the request url to command object. Something like this

class TestCommand
{
    List<Map<String, String>> ex
    static constraints = {}
}

I wanted to bind the data dynamically so that I can get ex[0].a = a0 and ex[0].b = b0 and use it in the controller directly. This is working fine for list. But, not working for list of maps. Is there any way to bind data like this

like image 395
Santosh Kumar Kurashetty Avatar asked Mar 09 '26 09:03

Santosh Kumar Kurashetty


1 Answers

have you tried using bindData?

after all, it doesn't matter how you make your request (by using jQuery or a conventional GET method) the thing is resolved server-side.

like image 110
genuinefafa Avatar answered Mar 12 '26 06:03

genuinefafa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!