ZK Web Framework 6.0 Released: New Data Binding System
Changes included in this new version include:
- New "ZK bind" system following the MVVM pattern
- jQuery/CSS 3 style selectors that run on server side
- Upgrade from jQuery 1.4.x to 1.6.x (performance improvements)
- Advanced templates
- ZK Comet support for Servlet 3 Asynchronous Processing
- New components (and deprecation of old ones)
- Upgrade to Java 5
- New default theme selection
The most important change is the new data binding system. ZK follows the Model View ViewModel pattern (MVVM), where the ViewModel layer is responsible for converting values from the Model to the View and updating them back when they are changed by the user. The graphical user interface is declared in a markup language completely separated by the data contained in the Model. In ZK the markup used is called ZK User Interface Markup Language (ZUML), while the actual business logic resides in Java code. The main principle here is that ZUML can be edited by non-programmers, allowing for parallel development of UI and Java code resulting in increased productivity. This pattern is not exclusive to ZK, other known examples include XUL from Mozilla and XAML from Microsoft. ZK also supports creating GUIs programmatically completely in Java via ZK Richlets.
"ZK bind" now accepts EL 2.2 expressions allowing for configurable data transfer (one way or two way) between ZUML graphic components and server side Java Objects. The ability to bind on CDI, Seam or Spring beans is directly supported. With the upgrade to Java 5 the use of generics and type safety is also available on the server code. Notice also that the old binding system from ZK 5 is still supported for those who need it, or do not want to upgrade right away.
Another new feature is the introduction of jQuery style selectors for server side Java code. This functionality offers developers a compact and easy way to access server side components. Here is an example taken directly out of ZK documentation:
Window win; // returns all components with id "myId" under the Window win. (including itself) Selectors.find(win, "#myId"); // returns all components whose .getLabel() value is "zk" (if applicable) Selectors.find(page, "[label='zk']"); // you can assemble the criteria: // returns all labels, whose parent is a window of id "win", and whose value is "zk" Selectors.find(page, "window#win > label[value='zk']");
Finally, ZK 6.0 takes advantage of the Servlet 3.0 Specification which supports asynchronous requests. This means that the Thread-Per-Request implementation can now be used instead of the Thread-Per-Connection one. Performance should be increased since threads can be recycled more frequently when not needed.
ZK 6.0 downloads come in multiple editions depending on the licence.For more information see the reference documentation and Javadocs. The source code is on GitHub. An upgrade guide is also available.
The old is new again an how does it compare to Vaadin?
I also wonder how ZK 6 would compare to Vaadin.
Re: Upgrade to Java 5?
Full remote conrol
Yoni Goldberg Oct 30, 2014
Dmytro Svarytsevych Oct 30, 2014