Using component selection and data models as Managed Beans

Top  Previous  Next

You can use selection and data models in ToolBar component as JSF Managed Beans.

 

1.Create the selection and data models.

 

2.Define the managed beans in the faces-config element of your application configuration file :

 

<managed-bean>

       <managed-bean-name>myToolbarDataModelBean</managed-bean-name>

       <managed-bean-class>testingapplication.toolbar.ToolBarDataModelBean</managed-bean-class>

       <managed-bean-scope>session</managed-bean-scope>

</managed-bean>

<managed-bean>

       <managed-bean-name>myToolbarSelectionModelBean</managed-bean-name>

       <managed-bean-class>testingapplication.toolbar.ToolBarSelectionModelBean</managed-bean-class>

       <managed-bean-scope>session</managed-bean-scope>

</managed-bean>

 

3.Define dataModel and selectionModel tag to specify which property beanName to use. For more information on using managed beans see JSF documentation.

 

       <toolbar:dataModel beanName="#{myToolbarDataModelBean}" scope="session"/>

       <toolbar:selectionModel beanName="#{myToolbarSelectionModelBean}" scope="session" />

 

You can see the managed bean example for ToolBar component in the testing application demo.