public String addEmployee(Employee employee){ //前台传送数据使用bean接收
System.out.println(employee + "状态:"+(employee==null));//当传送空数据时打印情况如下
---打印情况---> “ Employee [id=null, name=null, pwd=null, sex=null, birth=null, headImage=null, idCard=null, number=null, tel=null, qq=null, email=null] 状态:false ” 问题:此处Employee所有成员变量为null
为什么打印Employee时employee==null 不是true 而是false
顺带问个问题:angularjs传送Date类型后台 无法接收数据类型错误
private Date birth; //这个是后台类型
$scope.addEmpl.birth = new Date();//前台类型
input type="Date" id="birth" ng-model="addEmpl.birth//html绑定
birth:Wed Oct 18 2017 10:45:07 GMT+0800 (中国标准时间) // 前台取得值“”状态码400
后台接收依旧为上面的java bean
angularjs接到的时间是时间戳,不能用date接http://www.cnblogs.com/similar/p/5810304.html
$scope.emplBirth = new Date(); $scope.addEmpl.birth = new Date();$scope.addEmpl.birth = $filter("jsonDate")($scope.emplBirth, "yyyy-MM-dd HH:mm:ss");
filter("jsonDate", function($filter) {
return function(input, format) {
//先得到时间戳
var timestamp = Number(input.replace(/\/Date((\d+))\//, "$1"));
//转成指定格式
return $filter("date")(timestamp, format);
}
})
我改成这样了还是报错 : TypeError: input.replace is not a function
打印的地方不是true是因为 那个employee是个对象不是null 仅仅是employee里面的属性数据为空。
后面的那个 日期数据经过传输就变成字符串或数字了吧? 。日期转换有很多插件的。。。。