zk框架之XML

一、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

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值