Reputation: 135
I am sending a JSON obj to the server which will populate my domain obj Report.
public class CustomReport {String name;
String name;
String email;
Date invocieDate;
Date shipDate;
//...getters and setters
}
everything are populated but invoiceDate.
public void create(@RequestBody CustomReport report, HttpServletRequest request) {
System.out.println(report.getShipDate());
System.out.println(report.getInvocieDate()); // gives me null
System.out.println(report.getName());
}
I checked the request payload from the browser, i think the request is ok
{"name":"trace","email":"[email protected]","invoiceDate":"2015-01-01T06:00:00.000Z","shipDate":"2015-01-02T06:00:00.000Z"}
my js code is as following:
$scope.submit = function() {
console.log($scope.report.invoiceDate); //got value here
$http.post('/api/request/submit', $scope.report).success(function(data){
alert("success");
}).error(function(data,status,headers,config){});
is there anything wrong with my code? anything I could do to debug?
please help, any help will be appreciated.
Upvotes: 0
Views: 1107
Reputation: 3303
Look more carefully
in the JSON:
"invoiceDate":"2015-01-01T06:00:00.000Z"
in the class
Date invocieDate;
In both a name should be the same)
Upvotes: 2