Posting an array of JavaScript Objects and Mapping to Java Domain in Spring Controller Method
<p>I am trying to write an ajax post request that hits a Spring Controller method and delivers some request params, one of which is an array of JavaScript objects: vendorBillingDetails. These JavaScript objects have a matching Java domain class and I would like to map them to this domain class. This seems like something Spring MVC should be able to, but so far I have only been able to find examples using an html form with only one request param.</p>

<p>Below is my controller and ajax request. Hoping someone can tell me how to map this properly as everything I've tried so far has failed.</p>

<pre><code>$.ajax({
    url : '/ui/clearBilling',
    type : 'POST',
    data : { "trackId": trackId, "vendorBillingDetails": vendorBillingDetails,  "_csrf": csrf },
    async : true,
    success : function(data) {
            jqAlert("Selected item(s) were cleared");
    },
    fail: function(e) {
        jqAlert("There was an error with the request"); 
    }
});
</code></pre>

<p>}); </p>

<pre><code>@RequestMapping(value = "/clearBilling", method = RequestMethod.POST)
public @ResponseBody String setClearVendorBillingPO(@RequestParam BigInteger trackId, @RequestParam(value = "vendorBillingDetails[]") List&lt;VendorBillingDetail&gt; vendorBillingDetails, HttpServletRequest request) {

    //TODO stuff

}
</code></pre>