News Stay informed about the latest enterprise technology news and product updates.

Feature highlights from the ZK 8.5 release

ZK Team has just announced the release of ZK 8.5. The new release takes the core ZK 8 philosophy “Stay true to your Java roots and effortlessly keep up with front-end innovations” and continues to push the innovation envelope: a major improvement on MVVM data binding at the client side enlivened pure HTML content with minimal effort. The Fragment component, in combination with Service workers, allows for caching and managing offline user data and easier Progressive Web Apps (PWAs) building. Other exciting features include: 24 freshly baked modern themes, built-in Websocket, splitlayout component, smooth frozen component and more. Let’s take a look at some of the most interesting new features: 

1. Built-in Websocket

WebSocket is a new communication protocol standardized by the IETF as RFC 6455. It provides a full-duplex communication channel over a single TCP connection. Once the WebSocket connection has been established, all subsequent messages are transmitted over the socket rather than new HTTP requests/responses. Therefore, it can lower handshake overhead and reduce a lot of HTTP requests when there are many small updates comparing to AJAX server push. A server can actively send data to a client without a client’s request. So it’s more trivial than Comet. ZK now supports not only WebSocket-based update engine but also a WebSocket-based server push.

To enable websockets in ZK 8.5 all you need is to add the following <listener> to your zk.xml:


2. 24 Freshly baked themes

ZK 8.5 comes with a new theme called Iceblue as well as another 23 brand new, modern and elegant themes. To apply the desired theme, simply set the preferred theme in zk.xml:


You can also include multiple themes and allow each end user set his or her preferred theme in your application with cookies like:

Themes.setTheme(Executions.getCurrent(), "custom");

3. New Client-side Data Binding Component: Fragment

Fragment is a special component that turns a static HTML page into dynamic. It can bind an HTML snippet with data from a ViewModel with ZK data binding syntax. With this new component, you can create a custom HTML widget that’s not part of standard ZK components, e.g. custom layouts or custom components, and it binds the data from a ViewModel.

Behind the scene: fragment is a data container and renderer. It synchronizes data between itself and a server according to data binding syntax and it stores the data from server as JSON objects at the client-side. Inside a Fragment, the specified data binding syntax actually binds the JSON objects, and it renders HTML elements based on the JSON objects. This also reduces the server’s tracking nodes for data binding since data is tracked at the client-side.

View illustration

4. Source Maps for WPD Files

In previous versions, ZK merges/compresses javascript code into WPD files, but now with this new feature, if you enable javascript in zk.xml with the property below:


You can see separate JavaScript files for each widget with comments like this image.

If your browser supports source map, you can also see separate js files for every ZK widgets, not just WPD files (compressed files). It’s very useful when you wish to debug JavaScript code or customize widgets. You can still debug with uncompressed WPD even a browser doesn’t support this.

If you are interested, you can read more about ZK 8.5 New Features here.