I am trying to bind form data that is serialized alongside other data within an AJAX call. I can't seem to get Spring to pick it up. It just instantiates an empty form.
JavaScript:
$.ajax({
method: "GET",
url: contextPath,
data: {"form": serializedForm, "otherStuff": otherStuff},
contentType:"application/json; charset=utf-8",
cache: false,
success: function(data) {});
Controller:
@ResponseBody
@RequestMapping(value="/blah", method=RequestMethod.GET)
public String blah(@ModelAttribute("form") Form form, @RequestParam(value="otherStuff[]", required=false) String[] otherStuff, HttpServletResponse response){
//stuff
}
Is there a way to get Spring to map my form in the method parameter?
It seems like I can grab the parameters separately from an HttpServletRequest, but I would ideally like my form to go through an InitBinder.