use of org.springframework.web.bind.annotation.InitBinder in project portal by ixinportal.
the class ClientWebController method initBinder.
/**
* 自动时间格式转换
* @param binder
* @throws Exception
*/
@InitBinder
public void initBinder(WebDataBinder binder) throws Exception {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
CustomDateEditor dateEditor = new CustomDateEditor(df, true);
binder.registerCustomEditor(Date.class, dateEditor);
}
use of org.springframework.web.bind.annotation.InitBinder in project spring-integration-samples by spring-projects.
the class SharkController method registerConverters.
@InitBinder
void registerConverters(WebDataBinder binder) {
if (binder.getConversionService() instanceof GenericConversionService) {
GenericConversionService conversionService = (GenericConversionService) binder.getConversionService();
conversionService.addConverter(getLoanSharkConverter());
}
}
use of org.springframework.web.bind.annotation.InitBinder in project xxl-job by xuxueli.
the class IndexController method initBinder.
@InitBinder
public void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
}
use of org.springframework.web.bind.annotation.InitBinder in project steve by RWTH-i5-IDSG.
the class GlobalControllerAdvice method binder.
@InitBinder
public void binder(WebDataBinder binder) {
BatchInsertConverter batchInsertConverter = new BatchInsertConverter();
binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
binder.registerCustomEditor(LocalDate.class, new LocalDateEditor());
binder.registerCustomEditor(LocalDateTime.class, new LocalDateTimeEditor());
binder.registerCustomEditor(ChargePointSelect.class, new ChargePointSelectEditor());
binder.registerCustomEditor(List.class, "idList", batchInsertConverter);
binder.registerCustomEditor(List.class, "recipients", batchInsertConverter);
}
use of org.springframework.web.bind.annotation.InitBinder in project spring_boot by hryou0922.
the class FloatEditor method initBinder.
/**
* 此绑定只对输入的属性通过指定的CustomDateEditor执行解析,
* 但是不对返回客户端的属性进行解析
*
* @param binder
*/
// 必须有一个参数WebDataBinder
@InitBinder
public void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd"), false));
// 注释此句:对特定的属性,进行解析
// binder.registerCustomEditor(Date.class, "shortDate",new CustomDateEditor(new SimpleDateFormat("yyyy-MM"), false));
binder.registerCustomEditor(Integer.class, new IntegerEditor());
binder.registerCustomEditor(Float.class, new FloatEditor());
}
Aggregations