Use this data provider to wrap an individual JavaBean instance, making its properties available to value binding expressions. The following example describes how you might do this.
You have a JavaBean class named User
that has a String
property fullName
, among others. Also, you have a user
property on SessionBean1
representing the logged in user. On an Edit User Profile page, you want to bind a text field to this property, but you want to use a data provider because you might change your mind later and bind directly to a database row representing this user. You do this as follows:
user
property on SessionBean1
as described above.textField1
.objectDataProvider1
.user (SessionBean1)
option from the drop down list.objectDataProvider1
and select the fullName
field from this data provider.
The resulting binding expression will be something like the following:
#{Page1.objectDataProvider1.value['fullName']}