UUID Is ID

Traditional servlets and JavaScript codes usually depend on the id attribute, so UUID of XHTML components are made to be the same as ID. Therefore, developers need not to change their existent codes to adapt ZK, as shown below.

<img id="which"/>
<script type="text/javascript"><![CDATA[
//JavaScript and running at the browser
    function change() {    
        var el = document.getElementById("which");        
        el.src = "something.gif";        
    }    
]]></script>
<zscript><!-- Java and running at the server -->
    void change() {    
        which.src = "another.gif";        
    }    
</zscript>

Notice that UUID is immutable and nothing to do with ID for components other than XHTML. Thus, the above example will fail if XUL components are used. If you really want to reference a XUL component in JavaScript, you have to use EL expression to get the correct UUID.

<input id="which"/>
<script type="text/javascript">//Running at the browser
    var el = document.getElementById("${which.uuid}");    
    el = $e("${which.uuid}"); //$e() is an utility of ZK Client Engine    
</script>

Side Effects

Since UUID is ID, you cannot use the same ID for any two components in the same desktop.