java实现id生成器,在Java中实现静态ID生成器

Mu question is, how do I try it? After having a static id generator and adding the configurations in the zk.xml, what's next? How will I be able to run it and get the generated ids?

Thank you so much.

解决方案

You do not need to "run it". If you specify a custom ID generator in the configuration (zk.xml), the zk application you run will use it to automatically create a new ID for every widget on the client. Using a static ID generator just makes sure that the IDs are always created in the same sequence, the default one is somewhat random.

You can see the IDs in the browser (in the developer console, the html tree will show you the "id" attributes of certain elements). You can also access them by Component.getUuid().

By the way, there is also a built-in implementation of a static ID generator: org.zkoss.zk.ui.impl.StaticIdGenerator. Read zk's testing tipps, they mention it there and also explain why you would use it.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值