html、js前台数据传到后台,spring复杂类型转换
如果我有两个变量,变量名不一样,处理的规则也不一样,但是他们都是Date.class 类型, 这可怎么破。比如:
@InitBinder
publicvoidbindingPreparation(WebDataBinderbinder){
DateFormatdateFormat1=newSimpleDateFormat("d-MM-yyyy");
CustomDateEditororderDateEditor=newCustomDateEditor(dateFormat1,true);
DateFormatdateFormat2=newSimpleDateFormat("MMMd,YYYY");
CustomDateEditorshipDateEditor=newCustomDateEditor(dateFormat2,true);
binder.registerCustomEditor(Date.class,"orderDate",orderDateEditor);
binder.registerCustomEditor(Date.class,"shipDate",shipDateEditor);
}
spring中有很多种propertyEditor