|
Building the component dynamically |
|
To build the component dynamically using different data sources, the below approach should be used :
| 1. | Create the selection and/or data models. For example: |
public class TreeSelectionModelBean extends TreeSelectionModel {
public TreeSelectionModelBean () {
super ();
this.setCurrentSelection ( "1" );
}
}
| 2. | Declare the bean to use(this method of models instantiation is used for compatibility purposes only. We recommend using of JSF managed beans for the component models - see the item below ) on JSP page : |
<jsp:useBean id="treeSampleSelectionModel"
class="testingapplication.tree.TreeSelectionModelBean"
scope="session">
</jsp:useBean>
| 3. | Define dataModel and/or selectionModel tag to specify which model to use. |
<tree:treeSelection model="treeSampleSelectionModel"/>