【正文】
instructions. EL expressions use the syntax ${expr}. For example, When an EL expression is used as an attribute value, it could return any kind of objects as long as the ponent accepts it. For example, the following expression will be evaluated to a Boolean object. Standard implicit objects, such as param and requestScope, and ZK implicit objects, such as self and page, are supported to simplify the use. To import EL functions from TLD files, you could use a processing instruction called taglib as follows. The id Attribute To access a ponent in Java codes and EL expressions, you could assign an identifier to it by use of the id attribute. In the following example, we set an identifier to a label such that we could manipulate its value when one of the buttons is pressed. After pressing the Yes button, you will see the following. The following is any example for referencing a ponent in an EL expression. The if and unless Attributes The if and unless attributes are used to control whether to create a ponent. In the following examples, both labels are created only if the request has a parameter called vote. If both attributes are specified, the ponent won39。t be created unless they are both evaluated to true. The forEach Attribute The forEach attribute is used to control how many ponents shall be created. If you specify a collection of objects to this attribute, ZK Loader will create a ponent for each item of the specified collection. For example, in the following ZUML page, the listitem element will evaluated three times (for Monday, Tuesday and Wednesday) and then generate three list items. Thus, the above ZUML page is the same as follows. In additions to forEach, you can control the iteration with forEachBegin and forEachEnd. The use Attribute Embedding codes improperly in pages might cause maintenance headache. There are two ways to separate codes from views. First, you could listen to events you care, and then invoke the proper methods accordingly. For example, you could invoke your methods to initialize, process and cancel upon the onCreate,onOK and onCancel events. In addition, you must have a Java class called MyClass shown as follows. Second, you could use the use attribute to specify a class to replace the default ponent class. Then, you must have a Java class called MyWindow as follows. These two approaches have different advantages. They both act as the controller in the MVC paradigm. The choice is yours. Implement Java Classes in zscript Thanks to the power of BeanShell, the implementation of Java classes can be done in zscript as follows. To separate codes from the view, you can put all zscript codes in a separated file, say , and then, Create Components Manually In addition to describe what ponents to create in ZUML pages, developers could create them manually. All ponent classes are concrete. You create them directly with their constructors. In the above example, you could use the setVisible(true) method to have a similar effect. Define New Components for a Particular Page ZK provides a powerful yet simple way to let developers define new ponents for a particular pages. It is useful if most ponents of the same type share a set of properties. First, you use the ponent directive to define a new ponent. is equivalent to Moreover, you can override the definition of button altogether as follows. Of course, it won39。s activity such as moving mouse or changing a value. Once detected, it notifies ZK AU Engine by sending a ZK request. 5. Upon receiving ZK requests from Client Engine, AU Engine updates the content of corresponding ponent, if necessary. And then, AU Engine