BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News ZK Web Framework 6.0 Released: New Data Binding System

ZK Web Framework 6.0 Released: New Data Binding System

This item in japanese

Bookmarks

Potix, the company behind ZK has recently released version 6.0 of the Java based Ajax Web Application framework. ZK is an open source Java framework that allows developers to write rich internet applications based on Ajax without writing any JavaScript. Apart from example demos, the official web page also lists several real world applications that use ZK.

In a similar manner to the Google Web Toolkit, ZK abstracts all JavaScript and HTML focusing only on server side Java code for business logic. It achieves this by implementing a server side event engine and a JavaScript one on the client (the Web Browser). This way syncing between server data and client side presentation is completely automated. Programmers can write a complete application using the familiar Event Model of desktop frameworks such as Swing.

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.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

  • Full remote conrol

    by Annie Calvert,

    • The old is new again an how does it compare to Vaadin?

      by Oyku Gencay,

      Your message is awaiting moderation. Thank you for participating in the discussion.

      New data binding system seems like the old is new again. Reminded me of JSF 1 automatic data binding. Also the limitations it imposed.

      I also wonder how ZK 6 would compare to Vaadin.

    • Upgrade to Java 5?

      by Kai Wähner,

      Your message is awaiting moderation. Thank you for participating in the discussion.

      Is this a typo?

    • Re: Upgrade to Java 5?

      by Kostis Kapelonis,

      Your message is awaiting moderation. Thank you for participating in the discussion.

      No it is not. One of the features marked as fixed for the 6.0.0 release is "Make ZK compliant to Java 5, such as generics"

    • Full remote conrol

      by Annie Calvert,

      Your message is awaiting moderation. Thank you for participating in the discussion.

      The best feature of Framework 6.0 is that "full remote control” capability is present in it. In which developer has control of the response when session is expired or page not found or page lost (usually timeout) in normal requests and remote view/control.
      www.dapfor.com/en/net-suite/net-grid/tutorial/d...

    Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

    Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

    BT