Using component selection and data models as Managed Beans

Top  Previous  Next

You can use selection and data models in TabbedPanel component as JSF Managed Beans following the below approach.

 

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>myTabbedDataModelBean</managed-bean-name>

       <managed-bean-class>testingapplication.tabbedPanel.TabbedPanelDataModelBean</managed-bean-class>

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

</managed-bean>

<managed-bean>

       <managed-bean-name>myTabbedSelectionModelBean</managed-bean-name>

       <managed-bean-class>testingapplication.tabbedPanel.TabbedPanelSelectionModelBean</managed-bean-class>

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

</managed-bean>

 

 

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

 

<tabbedPanel:tabbedPanelData beanName="#{myTabbedDataModelBean}"

               scope="session"/>

<tabbedPanel:tabbedPanelSelection beanName="#{myTabbedSelectionModelBean}"

               scope="session" />

 

 

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