The id Attribute

To access a component 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.

<window title="Vote" border="normal">
    Do you like ZK? <label id="label"/>    
    <separator/>    
    <button label="Yes" onClick="label.value = self.label"/>    
    <button label="No" onClick="label.value = self.label"/>    
</window>

After pressing the Yes button, you will see the following.

The following is any example for referencing a component in an EL expression.

<textbox id="source" value="ABC"/>
<label value="${source.value}"/>