Associating Thin Beans with UINodes

Each BI Beans thin bean has two parts:

The UINode part of the thin bean aggregates the ThinBeanUI part of the bean. In a servlet application, you can associate a single, static ThinBeanUI instance to the UINode, or you can dynamically associate the ThinBeanUI instance with the UINode. Dynamic association allows you to reuse a UINode to render different instances of the ThinBeanUI.

When you use JSP tags, the Render tag statically associates the ThinBeanUI with the UINode. When you use UIX tags, you dynamically associate the definition element, in the biThinSession, with the UINode element, within the form element, through the select key.

Specifying a static ThinBeanUI

The following code shows how to bind a single ThinBeanUI instance to its UINode.


// create the ThinBeanUI instance ThinCrosstab crosstab = new ThinCrosstab(); // create the crosstab UINode CrosstabBean crosstabUINode = new CrosstabBean(); // bind the ThinBeanUI to the UINode -- static binding crosstabUINode.setCrosstab(crosstab);

Dynamically specifying a ThinBeanUI

To use different ThinBeanUI instances with a single UINode, you use data binding that is provided in UIX code. The following code shows how to bind a ThinBeanUI instance to a UINode dynamically.


// create the crosstab UINode CrosstabBean crosstabUINode = new CrosstabBean(); // set up dynamic binding, through a DataBoundValue crosstabUINode.setCrosstab(new DataBoundValue("MyNamespace", "MyCrosstab", "")); // create the ThinBeanUI instance ThinCrosstab crosstab = new ThinCrosstab(); // set the DataObject on the RenderingContext // this allows the UINode to fetch the crosstab when it prepares // to render HTML renderingContext.setDataObject("MyNamespace", "MyCrosstab", crosstab);

Note: The BI Beans UIX tags use data binding.

For more information about data binding, see the UIX Developer's Guide.