I use Spring MVC and in controller I have function:
@ResponseBody
@RequestMapping(value = "/json/negotiation/Supervisor.json", produces = "application/json", method = RequestMethod.POST)
public ExtResponse changeSupervisorStep(@RequestBody BatchModel<Supervisor> supervisors) {...}
From client-side I send request (use ExtJs) :
Ext.Ajax.request({
url : '/jur_rest/json/negotiation/Supervisor.json',
jsonData : { supervisors : {toInsert : [], toDelete : [], toUpdate : [] }}
});
and everything is fine, I get object with three arrays. But I would like to send once more model from client, and if I write something like that :
@ResponseBody
@RequestMapping(value = "/json/negotiation/Supervisor.json", produces = "application/json", method = RequestMethod.POST)
public ExtResponse changeSupervisorStep(@RequestBody BatchModel<Supervisor> supervisors, @RequestBody Supervisor model) { ... }
Ext.Ajax.request({
url : '/jur_rest/json/negotiation/Supervisor.json',
jsonData : { supervisors : {toInsert : [], toDelete : [], toUpdate : [] }, model : {}}
});
I get error - 400 Bad Request. What's wrong? Thanks.
EDIT:
learning Spring's @RequestBody and @RequestParam There can be only one @RequestBody parametr in controller function. How can I pass two models in one request? Combine them into one class?