【问题标题】:Do any of the "modern" frameworks support data binding checked at compilation time?是否有任何“现代”框架支持在编译时检查数据绑定?
【发布时间】:2014-09-17 17:08:34
【问题描述】:

这是对这个问题的跟进:Are there any web frameworks for JVM with data binding checked at compilation time?

在那个问题中,接受的答案是 JSP。

我的问题是,是否有任何现代框架,如 Wicket、Play 2.0、Spring MVC、Vaadin、Grails、Tapestry、JSF、GWT 等支持编译时绑定的这一特性?

我了解新开发人员更喜欢没有任何编译时检查的动态绑定,因此该功能已从大多数现代语言和框架中删除。我只是想知道他们中是否有人保留了对这个特定旧功能的支持,即使它作为一个选项被支持。

【问题讨论】:

    标签: java web frameworks jvm


    【解决方案1】:

    据我所知,Vaadin 8 支持这种与 Java lambda 表达式的绑定。

    Binder<Person> binder = new Binder<>();
    
    TextField titleField = new TextField();
    
    // Start by defining the Field instance to use
    binder.forField(titleField)
      // Finalize by doing the actual binding to the Person class
      .bind(
        // Callback that loads the title from a person instance
        Person::getTitle,
        // Callback that saves the title in a person instance
        Person::setTitle));
    

    详见文档:https://vaadin.com/docs/framework/datamodel/datamodel-forms.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-16
      • 2012-09-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-08
      相关资源
      最近更新 更多