...
"property1.property2"
: Both properties are looked up in the same way as mentioned above. If theproperty1
evaluates to null and there exists a setter with nameproperty1
on the model object and the class representing the class representingproperty1
has a default constructor then a new instance will be constructed and assigned on the model object via theproperty1
and theproperty2
will be set on this new object.
...
Wiki Markup |
---|
Index or map properties can be alternatively written as: {{"property\[index\]"}} or {{"property\[key\]"}}. |
For example, if we have a following class:
Code Block | ||||
---|---|---|---|---|
| ||||
public static class Person { private String name; private Person parent; public String getName() { return name; } public void setName(String name) { this.name = name; } public Person getParent() { return parent; } public void setParent(Person parent) { this.parent = parent; } } |
Then we can use the following expressions:
name
can be used to access getters and setter for thename
propertyparent.name
can be used to retrieve or set the name of a parent. If there is no parent set (i. e. it is null), a new instance ofPerson
is created and set on the model object. Thereafter aname
property is get/set on this new instance.
Panel | ||
---|---|---|
| ||
We started out with OGNL in the past but: Eelco Hillenius |