I have a simple POJO Java class (getters and setters is not shown)
public class VacationInfo {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Temporal(TemporalType.TIMESTAMP)
private Date vacationFrom;
@Temporal(TemporalType.TIMESTAMP)
private Date vacationTo;
, Spring MVC controller with next method
@RequestMapping(value = "updateVacations", method = RequestMethod.POST)
public String updateVacations(@RequestParam VacationInfo[] vacationInfos) {
...
}
and jQuery post request
$.ajax({
type: "POST",
url: "updateVacations",
dataType: 'json',
data: vacationInfos
});
where "vacationInfos" is a array with JSON objects, which represent VacationInfo class:
[
{
vacationFrom: "01-01-2013",
vacationTo: "01-01-2013"
},
{
vacationFrom: "01-01-2013",
vacationTo: "01-01-2013"
}
]
But when I do request - i got a HTTP 400 error.