Pages

Friday, September 14, 2012

Using managed property to evaluate bindings

In this post, I will describe how to get hold of DCBindingContainer using managed property.

Managed property is a bean attribute that is exposed through getter and setter methods in a managed bean. The <managed-property> element is a child of <managed-bean> element in adfc-config.xml. It calls its equivalent setter method defined in the managed bean upon bean initialization. Managed property must have a name and a value.
                                                  Managed property can be defined in adfc-config.xml to have an expression always evaluated and ready for use. For example, a managed property can be used to evaluate #{bindings}, which is used to get hold of DCBindingContainer.

For this, define a managed bean and register the bean in adfc-config.xml file. In adfc-config.xml, select the bean, where a managed property has to be defined. Click on Add(+) button to add a managed property:

 

after the modification, the source code looks like:


In the bean define getter and setter for the managed property as:


You can use (DCBindingContainer)getBindings to get hold of DCBindingContainer as shown above.

1 comment:

  1. Hey thanks for the post! I always just added my own custom method to return BindingContext.getCurrent().getCurrentBindingEntry() but your managed bean property way is so much more elegant/cooler!

    ReplyDelete