Question

So, let us say we want to do some things like this:

<label zclass="class1 class2 @load(vm.class)" />

How to do this in ZK?

the above code render zclass as class1 class2 @load(vm.class). But we want to execute @load?

Was it helpful?

Solution

You can use cat-like methods from the core taglib to concatenate strings. Something like this:

<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
...
<label zclass="@load(c:cat('class1 class2 ', vm.class))" />

For more details on core methods see here

OTHER TIPS

To do this, i went with an AbstractViewModel that contains all those "technical" methods i would like to use in my Zul.

Then i make every of my Viewmodel extends this abstractViewModel

public class AbstractTechnicalViewModel {

    /** @see java.text.MessageFormat#format(String, Object...) */
    public String format(final String pPattern, final Object... pParams) {
        return MessageFormat.format(pPattern, pParams);
    }

    /** @see org.apache.commons.lang.StringUtils#concatenate(Object[]) */
    public String concat(final Object... pParams) {
        return StringUtils.join(pParams);
    }
}

And then in my zul

tooltiptext="${vm.format(labels.my.label, param1)}"

Regards

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top