0

if tag issue

asked 2011-08-31 13:34:26 +0800

jayzk gravatar image jayzk
37 3

updated 2011-08-31 14:22:11 +0800

Hi,

I have a scenario to display some buttons based on an a condition from a Util Class. for example:

<zk if="${AppUtils.isColor('Green') == 'true'}">
	<button
		id="${greenButtonId}" label="${greenButtonLabel}"
		forward="onClick=onGreenClick"/>
</zk>


If get a syntax error
org.zkoss.xel.XelException: Encountered "(", expected one of ["}", ".", ">", "gt", "<", "lt", "==", "eq", "<=", "le", ">=", "ge", "!=", "ne", "[", "+", "-", "*", "/", "div", "%", "mod", "and", "&&", "or", "||", "?"]

Any suggestions please.

Thanks
/J

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2011-08-31 21:54:00 +0800

matthewgo gravatar image matthewgo
375

updated 2011-08-31 21:57:45 +0800

Hi
please use xel method

.java

package org.zkoss;

import java.util.ArrayList;
import java.util.Collection;

public class AppUtil {
  public static boolean isColor(String color){
	  return color.equals("green");
  }
}

.zul

<?xel-method prefix="c" name="test" class="org.zkoss.AppUtil"
   signature="java.lang.Boolean isColor(java.lang.String)"?>
<zk if="${c:test('green')}">
    <button label="hello xel-method"/>
</zk>


link publish delete flag offensive edit

answered 2011-09-01 01:47:22 +0800

jayzk gravatar image jayzk
37 3

thanks matthewgo, that is very helpful.

/J

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

Follow

RSS

Stats

Asked: 2011-08-31 13:34:26 +0800

Seen: 309 times

Last updated: Sep 01 '11

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