A user asks an interesting question on the OTN forum about how to bind attributes that are added at runtime to a view object using the addDynamicAttribute() API. I've added example #29 (Creating a Dynamic Attribute Binding for a Dynamic View Object Attribute) to my not yet documented ADF examples page to illustrate how to do it.
This small sample illustrates how to create an attribute control binding at runtime for your dynamically created View Object attribute. The TestPage illustrates a JSTL-based read-only table, based on having dropped a "Read-Only Dynamic Table" from the data control palette. The dynamic table binding figures out its attributes at runtime, so it picks up the "Foo" attribute that is added by the addDynamicAttribute("Foo") call in the DeptViewImpl.java file's create() method. The TestPageAction class in the ViewController project illustrates how to programmatically add an attribute binding for the dynamic "Foo" attribute if it's not already there. The TestPage.jsp uses this binding to allow the user to enter a value for Foo for any row in the Dept table.
1:21:01 AM
|