Making a list of checkbox from a list variable in a GenericForwardComposer

asked 2010-01-11 11:40:21 +0800

cr4k gravatar image cr4k

Hi guys,

Firstly I'd like to say that we appreciate all the work that has been contributed to zk.

Hopefully this is a simple problem that is easy to fix if I am pointed in the right direction. I have the following semi working code:

in my GenericForwardComposer

public List<ListItem> getMyListItems() {
return myListItems;

in my zul page:

<listbox model="@{mainCtrl.myListItems}">
<listitem self="@{each=myListItem}">
<checkbox label="@{myListItem.name}" />

This is giving me some checkboxes dynamically generated using a list taken from a getter in the GenericForwardComposer, but I don't want to use listbox. I tried the following, but it doesn't work

<zk forEach="@{mainCtrl.myListItems}">
<checkbox label="@{each.name}" />

I don't really understand the difference between @{} and ${} as well and it is hard to look up (since they are just symbols)

All help appreciated



delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2010-01-11 16:45:34 +0800

robertpic71 gravatar image robertpic71
1275 1

>> I don't really understand the difference between @{} and ${} as well and it is hard to look up (since they are just symbols)
There is a big difference:

${} is JSP-stuff, and is designed as "renderhelp". It's only evaluted during the firsttime rendering. EL is a little bit more flexible, you could use i.e. conditions.
The main advantage: You could EL's for the forEach-Attribute and if-Attribute.
Note: forEach and if are also "renderhelpers" - it is only for the first time build of the GUI

@{} is two-way-binding - you could not use @{} for the attributes forEach and if
the main advantage: 2-way-binding, you can perform extra load and save

For your example:
modeldata: myListItems

${}: you get the checkboxes from the model while the GUI is rendered the first time, if there a change in the model (myListItems) - nothing happens
@{} (with listbox): the same as ${}, but could fire reload the UI via databinder, after the modelchange you could refresh the model with binder.loadXXX or
listbox model="@{mainCtrl.myListItems, load-after=....}">

The problem is, that not all components offer an model - so @databinding is not possible for all GUI-Constructs (i.e. checkboxes without Listbox or Row).
Of course you could try to mix ${} and @{}, but ${} is not reloadable....

Check also this thread.


And next time in the help section please.

link publish delete flag offensive edit

answered 2010-01-12 07:03:44 +0800

cr4k gravatar image cr4k

thanks that helped!

>>And next time in the help section please.

will do

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2010-01-11 11:40:21 +0800

Seen: 991 times

Last updated: Jan 12 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More