Richlets

A richlet is a small Java program that creates all necessary components in response to user's request.

When a user requests the content of an URL, the ZK loader checks if the resource of the specified URL is a ZUML page or a richlet. If it is a ZUML page, then the ZK loader creates components automatically based on the ZUML page's content as we described in the previous chapters.

If the resource is a richlet, the ZK loader hands over the processing to the richlet. What and how to create components are all handled by the richlet. In other words, it is the developer's job to create all necessary components programmingly in response to the request.

The choice between ZUML pages and richlets depends on your preference. For most developers, ZUML pages are better for the readability and simplicity.

It is straightforward to implement a richlet. First, implement the org.zkoss.zk.ui.Richlet interface and then declare the association of the richlet with an URL.