iterate on int value
26 Jul 2011 02:51:22 GMT
26 Jul 2011 15:20:25 GMT
26 Jul 2011 15:20:25 GMT
byteo,
If I understand your question correctly, can use Expression Language (EL) to accomplish what you ask. Here is an example:
<zk>
<window title="ForEach example" border="normal" style="padding:25px;">
<zscript>
int[] values = {1, 2, 3, 4, 5, 6, 7, 8, 9 , 10};
</zscript>
<separator height="25px"/>
<vlayout>
<label forEach="${values}" value="${each}"/>
</vlayout>
<separator height="25px"/>
</window>
</zk>
Be advised, however, that EL is only evaluated once and very early in the cycle. As such, is is mainly appropriate for static types of data. Otherwise, I'd encourage you to use something that takes a model (such as a grid or listbox).
For more information on EL usage in ZK, click here.
Hope that helps,
Todd
27 Jul 2011 02:45:52 GMT
27 Jul 2011 02:45:52 GMT
thanks but my problem is:
int i=0
int value=4
while i<4
<print something>
28 Jul 2011 16:08:19 GMT
28 Jul 2011 16:08:19 GMT
Hope that gives you an idea or two...
Hmmm, I can't think of an easy way to do that in zul. However, ZK can certainly handle it. Here are a couple of very simple examples:
Executions
<zk>
<vlayout id="myLayout"/>
<zscript>
<![CDATA[
int i = 1;
while (i < 4) {
Executions.getCurrent().createComponentsDirectly("<label value='xxx' />", null, myLayout, null);
i++;
}
]]>
</zscript>
</zk>
appendChild
<zk>
<vlayout id="myLayout"/>
<zscript>
<![CDATA[
int i = 1;
while (i < 4) {
myLayout.appendChild(new Label("yyyy"));
i++;
}
]]>
</zscript>
</zk>
Hope that gives you an idea or two...
Todd
29 Jul 2011 03:09:57 GMT
29 Jul 2011 03:09:57 GMT
fine! thank you!
9 Aug 2011 01:20:21 GMT
9 Aug 2011 01:20:21 GMT
wow!!
ZK - Open Source Ajax Java Framework
Hi,
I didn't found any example about zk VALUE iteration on zul page...
-----------------------
int num=4
foreach < num > print <something> on zul page
-----------------------
It's possible?
THANK YOU!