3
POST http://localhost:7001/app/workflow/execute/ 400 (Bad Request)
I’m getting this error when trying to send 2 array’s to my Spring controller, but I’m getting this error, tried some solutions I found on Soen but was not successful. The version of my Spring is the 3.0.2.
JS Code
var url = '/app/workflow/execute/';
$.ajax({
url: url,
type: 'POST',
dataType: 'json',
data: {
processName : pName,
argumentsNameArray : argumentsNameArr,
argumentsValArray : argumentsValArr
},
})
.done(function(data) {
console.log(data);
});
Java code
@RequestMapping(value = "/workflow/execute/", method = RequestMethod.POST)
@ResponseBody
public WorkflowProcess executeWFProccess(
@PathVariable("processName") String processName,
@PathVariable("argumentsNameArray[]") String[] argumentsNameArray,
@PathVariable("argumentsValArray[]") String[] argumentsValArray) {
WorkflowProcess wfProcess = new WorkflowProcess();
ArrayList<WFArgument> wfArguments = new ArrayList<WFArgument>();
wfProcess.setProcessName(processName);
for (int i = 0; i < argumentsNameArray.length; i++) {
wfArguments.add( new WFArgument(argumentsNameArray[i], argumentsValArray[i]) );
}
wfProcess.setArguments(wfArguments);
return wfProcess;
}
Thank you very much, @Bruno César! Using the
@RequestParam
worked properly.– Eduardo Silva