Java Code Examples for org.springframework.web.bind.WebDataBinder#registerCustomEditor()
The following examples show how to use
org.springframework.web.bind.WebDataBinder#registerCustomEditor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TodoController.java From docker-crash-course with MIT License | 5 votes |
@InitBinder public void initBinder(WebDataBinder binder) { // Date - dd/MM/yyyy SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); binder.registerCustomEditor(Date.class, new CustomDateEditor( dateFormat, false)); }
Example 2
Source File: BaseController.java From disconf with Apache License 2.0 | 5 votes |
/** * 绑定时间 * * @param binder */ @InitBinder protected void dateBinder(WebDataBinder binder) { // The date format to parse or output your dates SimpleDateFormat dateFormat = new SimpleDateFormat(WebConstants.TIME_FORMAT); // Create a new CustomDateEditor CustomDateEditor editor = new CustomDateEditor(dateFormat, true); // Register it as custom editor for the Date type binder.registerCustomEditor(Date.class, editor); }
Example 3
Source File: ConvertDateConfig.java From Roothub with GNU Affero General Public License v3.0 | 5 votes |
@Override public void initBinder(WebDataBinder binder, WebRequest request) { // 转换日期,注意这里的转化要和传进来的字符串的格式一直 如 2015-9-9 就应该为 yyyy-MM-dd DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); // CustomDateEditor 为自定义日期编辑器 binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); }
Example 4
Source File: StudentController.java From SOFRepos with MIT License | 5 votes |
@InitBinder public void initBinder(WebDataBinder binder) { SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy"); binder.registerCustomEditor(Date.class, new CustomDateEditor( dateFormat, true)); // binder.setValidator(photoValidator); }
Example 5
Source File: BindingInitializer.java From Lottery with GNU General Public License v2.0 | 4 votes |
/** * 初始化数据绑定 */ public void initBinder(WebDataBinder binder, WebRequest request) { binder.registerCustomEditor(Date.class, new DateTypeEditor()); }
Example 6
Source File: EmployeeController.java From Spring-5.0-Cookbook with MIT License | 4 votes |
@InitBinder("employeeForm") public void initBinder(WebDataBinder binder){ binder.registerCustomEditor(Integer.class, "age", new AgeEditor()); binder.registerCustomEditor(Date.class, new DateEditor()); }
Example 7
Source File: HandlerMethodAnnotationDetectionTests.java From spring-analysis-note with MIT License | 4 votes |
@InitBinder public void initBinder(WebDataBinder dataBinder, @RequestParam("datePattern") String thePattern) { CustomDateEditor dateEditor = new CustomDateEditor(new SimpleDateFormat(thePattern), false); dataBinder.registerCustomEditor(Date.class, dateEditor); }
Example 8
Source File: WebDataBinderAdvice.java From kaif with Apache License 2.0 | 4 votes |
@InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(FlakeId.class, new WebDataBinderAdvice.FlakeIdPropertyEditor()); }
Example 9
Source File: DocumentController.java From maven-framework-project with MIT License | 4 votes |
@InitBinder protected void initBinder(WebDataBinder binder) { binder.registerCustomEditor(String.class, new StringTrimmerEditor(true)); }
Example 10
Source File: ServletAnnotationControllerHandlerMethodTests.java From java-technology-stack with MIT License | 4 votes |
@InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(String.class, new StringMultipartFileEditor()); }
Example 11
Source File: SystemUserController.java From mumu with Apache License 2.0 | 4 votes |
@InitBinder public void initBinder(WebDataBinder binder) { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); dateFormat.setLenient(true); binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); }
Example 12
Source File: MetricsController.java From ExecDashboard with Apache License 2.0 | 4 votes |
@InitBinder public void initBinder(final WebDataBinder webdataBinder) { webdataBinder.registerCustomEditor(MetricType.class, new MetricTypeConverter()); }
Example 13
Source File: WorkspaceAdvice.java From WebIDE-Backend with BSD 3-Clause "New" or "Revised" License | 4 votes |
@InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(Workspace.class, new WorkspaceEditor(wsMgr)); }
Example 14
Source File: BookController.java From Spring-Boot-2.0-Cookbook-Second-Edition with MIT License | 4 votes |
@InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(Isbn.class, new IsbnEditor()); }
Example 15
Source File: HandlerMethodAnnotationDetectionTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public void initBinder(WebDataBinder dataBinder, @RequestParam("datePattern") String thePattern) { CustomDateEditor dateEditor = new CustomDateEditor(new SimpleDateFormat(thePattern), false); dataBinder.registerCustomEditor(Date.class, dateEditor); }
Example 16
Source File: AuditResource.java From ServiceCutter with Apache License 2.0 | 4 votes |
@InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(LocalDateTime.class, new LocaleDateTimeEditor("yyyy-MM-dd", false)); }
Example 17
Source File: BaseController.java From dpCms with Apache License 2.0 | 4 votes |
@InitBinder public void initBinder(WebDataBinder binder) throws Exception { CustomDateEditor dateEditor = new CustomDateEditor(Constants.DF, true); binder.registerCustomEditor(Date.class, dateEditor); }
Example 18
Source File: ProviderServiceImpl.java From venus-cloud-feign with Apache License 2.0 | 4 votes |
@InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss.SSSZ"), true)); }
Example 19
Source File: CollectionController.java From AIDR with GNU Affero General Public License v3.0 | 4 votes |
@InitBinder public void initBinder(WebDataBinder binder) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); }
Example 20
Source File: FileAction.java From Student-Homework-Management-System with MIT License | 2 votes |
/** * 自定义类型转换器 * * @param binder {@link WebDataBinder} * @throws Exception Exception */ @InitBinder public void initBinder(WebDataBinder binder) throws Exception { binder.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"), true)); }