一、A XML Element Represents a Component
每个XML元素都代表一个component,除了特殊的<zk><attribute>,因此,下面的ZUML将创建三个component
<window>
<textbox/>
<button/>
</window>
在上面的ZUML中,component之间的关系和xml的结构一样。
二、special XML Element
<zk>....</zk>
<window>
<zk if="${whatever}">
<textbox/>
<button/>
</zk>
</window>
等价于
<window>
<textbox if="${whatever}"/>
<button if="${whatever}"/>
</window>
三、A XML Attribute Assigns a Value to a Component's Property or Event Listener
<window title="hello"/>
<window title="${param.name}"
<button onClick="myFunc()"/>
我们可以用前缀指定不同的语言,如下:
<vlayout onClick="groovy:self.appendChild(new Label("new"));">
click me
</vlayout>
Special Attribut
<listbox>
<listitem label="each.name" forEach="customs"/>
</listbox>
四、A XML Text Represents Label Component or Property's Value
通常情况下,xml text 会作为label的文字
<window>
Begin ${foo.whatever}
</window>
等价于
<window>
<label value="Begin ${foo.whatever}"/>
</window>
还可以作为属性的值
<html>Begin ${foo.whatever} </html>
等价于
<html content="Begin ${foo.whatever}"/>
五、A Xml Processing Instruction Specifies the Page-wide Information
<?page title="hello world" style="background:grey"?>
六、EL Expression
在core java中我们对EL表达式已经比较熟悉了,在此不再详细介绍,其与java语言比较:
1、'abc'和"abc"是一样的
2、empty操作符可以检查参数是否为null和empty,比如${empty param.add}
3、.操作符可以用来获取一个对象的属性,可想象成改对象有一个get方法
4、[]操作符可以用来去map、list、array中的值
5、当value没有找到或者越界时会返回null