Version 3

    Predefined variables available in CDK templates

     

    facesContext - instance of FacesContext for this request

    component - instance of UIComponent being rendered

    responseWriter - instance of ResponseWriter to render the component

    clientId - client identifier of the component being rendered

    this - instance of generated renderer itself

    super - parent of 'this'

     

    Supported types of EL expressions

     

    EL-expression

    Compiled expression

    Identifiers - one of the variables available in scope

     

    Additional identifiers can be declared via <cdk:object> tag

    #{component}

    #{clientId}

    component

    clientId

    Values - combination of expressions

    #{facesContext.externalContext}

    #{component.children[0]}

    facesContext.getExternalContext()

    component.getChildren().get(0)

    Integer, string, double, boolean literals

    #{'some string'}

    #{5}

    #{2.718}

    #{true}

    #{false}

    "some string"

    5

    Double.valueOf(2.718)

    true

    false

    Null expression

    #{null}

    null

    Arithmetic operations

     

    (in the following examples 'a' and 'b' are number value identifiers)

    #{a + b}

    #{a - b}

    #{a * b}

    #{a / b}

    #{a div b}

    #{a % b}

    #{a mod b}

    #{-a}

    a + b

    a – b

    a * b

    a / b

    a % b

    a % b

    a % b

    -a

    Boolean operations

     

    (in the following examples 'a' and 'b' are boolean value identifiers)

    #{a and b}

    #{a && b}

    #{a or b}

    #{a || b}

    #{not a}

    #{!a}

    a && b

    a && b

    a || b

    a || b

    !a

    !a

    Comparison operations

     

    (in the following examples 'a' and 'b' are number value identifiers)

    #{a > b}

    #{a gt b}

    #{a < b}

    #{a lt b}

    #{a >= b}

    #{a ge b}

    #{a <= b}

    #{a le b}

    a > b

    a > b

    a < b

    a < b

    a >= b

    a >= b

    a <= b

    a <= b

    Equality test operations

     

    #{a == b}

    #{a eq b}

     

     

     

     

    #{a == null}

    #{a eq null}

     

     

     

     

     

     

    #{a != null}

    #{a ne null}

     

     

     

     

    #{a != b}

    #{a ne b}

    If 'a' & 'b' are both primitive types:

    a == b

    otherwise:

    isEqual(a, b)

     

     

    If 'a' is non-primitive type:

    a == null

    otherwise

    isEqual(a, null)

     

     

     

     

    If 'a' is non-primitive type:

    a != null

    otherwise

    !isEqual(a, null)


     

    If 'a' & 'b' are both primitive types:

    a != b

    otherwise:

    !isEqual(a, b)

    Choice operator

     

    (in the following example 'a' and 'b' are arbitrary expressions and 'test' is boolean value expression)

     

    Type of the expression is determined by the type of 'a' expression, unless 'a' has unknown type (e.g. it's equivalent to 'null' identifier)

    #{test ? a : b}

    test ? a : b

    Bracket expression

    If 'l' is array:

    #{l[i]}

     

    otherwise:

    #{m[key]}

     

    l[i]

     

     

    m.get(key)

    Property expression

     

    (in the following examples 'o' is arbitrary object value)

    #{o.myProperty}

    #{o.name}

    o.getMyProperty()

    o.getName()

    Empty operator

     

    (in the following examples 'o' is arbitrary object value)

    #{empty o}

    isEmpty(o)

    Method expression

     

    (in the following examples 'o' is arbitrary object value that has

    String computeValue(String)

    and

    String toString() methods)

    #{o.computeValue('test')}

     

    #{o.toString()}

    o.computeValue("test")

     

    o.toString()

    Function expression

    #{variableName:methodName(arg0, ..., argN)}

     

     

    #{methodName(arg0, ..., argN)}

    variableName.methodName(arg0, ..., argN)

     

     

    this.methodName(arg0, ..., argN)

    Deferred expression - composition of several aforementioned expressions

    #{(a ne null) ? cc.attributes['name'] : 'default'}

    a != null ? (cc.getAttributes().get("name")) : ("default")

    Mixed expression

    #{clientId}:suffix

    "clientId" + ":suffix"

     

    Types conversion


    Currently the following conversions between types are supported:

    • Object -> boolean, using generated convertToBoolean() method.

      Example usage:

      <cdk:object type="boolean" name="disabledAttrValue" value="#{component.attributes['disabled']}" />

    • Object -> String, using generated convertToString() method.

      Example usage.

      <cdk:object type="String" name="componentValue" value="#{component.attributes['value']}" />