...
Looking at our example POJO, the property expression "name"
can be used to access the "name"
property of any Person object via the getName()
getter method. Also, when updating a model, using property expression "name"
has the effect of calling setName(String)
. Hence construct a property model to use our POJO, give it a property expression "name"
and set it on a TextField
, not only will that TextField
display the current value of the "name"
property, it will also update the "name"
property with any user input provided.
More complex property expressions are possible as well. For example, you can access sub-properties via reflection using a dotted path notation, which means the property expression {{ Wiki Markup "person.name"
}} is equivalent to calling {{getPerson().getName()
}} on the given model object. Arrays can be accessed as in "{{persons
\[4
\].name
}}". As you can see, PropertyModels are quite a powerful way to give Wicket components access to model objects.
Info | ||
---|---|---|
| ||
More information on the allowed property expressions can be found either in the |
...
Warning | |||||
---|---|---|---|---|---|
| |||||
In the event that you need more flexibility or property expressions power in your compound models, you can use the
The |
...