JSF Managed Bean
by, 01-02-2012 at 06:51 PM (1294 Views)
JSF managed beans are defined in configuration file and these are java beans to hold data from JSF components. They represent data model and are passed between JSF business logic and JSF pages.
Following are the main features of managed beans.
• They use declarative model
• They provide an entry point
• Beans with various states
Following code shows a managed bean which has a session scope. Instance of this managed bean is created at the start of a user session.
XML Code: Managed Bean Tags<managed-bean> <managed-bean-name>myBean</managed-bean-name> <managed-bean-class>myPackage.MyBean</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean>