Dashboard > OGNL > Home > Operators That Differs From Java
  OGNL Log In View a printable version of the current page.  
  Operators That Differs From Java
Added by tm_jee, last edited by tm_jee on Dec 21, 2007  (view change)
Labels: 
(None)

For the most part, OGNL's operators are borrowed from Java and work similarly to Java's operators. See the OGNL Reference for a complete discussion. Here we describe OGNL operators that are not in Java, or that are different from Java.

  • The comma (,) or sequence operator. This operator is borrowed from C. The comma is used to separate two independent expressions. The value of the second of these expressions is the value of the comma expression. Here is an example:
    ensureLoaded(), name

    When this expression is evaluated, the ensureLoaded method is called (presumably to make sure that all parts of the object are in memory), then the name property is retrieved (if getting the value) or replaced (if setting).

  • List construction with curly braces ({}). You can create a list in-line by enclosing the values in curly braces, as in this example:
    { null, true, false }
  • The in operator (and not in, its negation). This is a containment test, to see if a value is in a collection. For example,
    name in {null,"Untitled"} || name
  • See the OGNL reference for a full list of operations

Site powered by a free Open Source Project / Non-profit License (more) of Confluence - the Enterprise wiki.
Learn more or evaluate Confluence for your organisation.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.9 Build:#527 Sep 07, 2006) - Bug/feature request - Contact Administrators