Java 8 vaadin8日期字段:无法将java.time.LocalDate强制转换为java.util.Date

Java 8 vaadin8日期字段:无法将java.time.LocalDate强制转换为java.util.Date,java-8,vaadin8,Java 8,Vaadin8,我有简单实体(例如) 用户界面代码: final Binder<People> binder = new Binder<People>(People.class); ... People bean=new People(); binder.setBean(bean); DateField birthdate = new DateField("date of birth"); binder.bind(birthdate, "birthdate"); 我试着用

我有简单实体(例如)

用户界面代码:

 final Binder<People> binder = new Binder<People>(People.class);  ...
 People bean=new  People();
 binder.setBean(bean);
 DateField birthdate = new DateField("date of birth");
 binder.bind(birthdate, "birthdate");
我试着用

 DateField birthdate = new DateField("birthdate");
 binder.bind(birthdate, "birthdate");
 binder.forField(birthdate).withConverter(new LocalDateToDateConverter());
但结果是一样的。
如何正确地将日期绑定到日期字段?

问题在于如何使用
活页夹。相反,尝试

DateField birthdate = new DateField("birthdate");
binder.forField(birthdate).withConverter(new LocalDateToDateConverter()).bind("birthdate");

forField
方法返回遵循生成器设计模式的对象。这意味着您可以在该对象上调用一些(链接)方法,并通过调用
bind

来完成它。您是否可以将person birthdate属性更改为LocalDate?使用
LocalDateToDateConverter
进行绑定对于我来说在Vaadin 8.3.2中效果很好,你能分享一个,这样我们可以复制它吗?请张贴你的完整活页夹代码。我猜您在尝试使用
LocalDateToDateConverter
时错过了
bind()
调用?@SteffenHarbich我更新了我的问题
 DateField birthdate = new DateField("birthdate");
 binder.bind(birthdate, "birthdate");
 binder.forField(birthdate).withConverter(new LocalDateToDateConverter());
DateField birthdate = new DateField("birthdate");
binder.forField(birthdate).withConverter(new LocalDateToDateConverter()).bind("birthdate");