Originally, to activate the Data Binding Manager, users have to define the page initializer at the top of the page like this:
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?>
This set of code creates an AnnotateDataBinder instance and set the instance as a variable named "binder" of the component, and then calls loadAll() to initiate all UI components from the associated data source. For more detailed information, please refer to ZK developer’s reference.
However, with ZK 5.0.8 there is now a new and cleverer way in which users can adopt to do achieve the same outcome – by defining a dedicated Composer – AnnotateDataBindingComposer. The code of AnnotateDataBindingComposer.java is simple and easy to read and understand.
The old way:
The equivalent new way:
Users are allowed to apply multiple composers to a component. For lifecycle issues, please apply AnnotateDataBindingComposer at the end.