Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Managed-Bean Data
Revision as of 20:06, 3 October 2006 by Unnamed Poltroon (Talk)
Background
Managed bean data allows a JSF application configuration file to set values on managed beans automatically when they are placed in scope. There are two types of managed-bean data: direct entries and managed properties.
Direct Entries
If a managed bean implements the Map or List interface, then managed-bean data can be configured directly on the bean itself. Consider the following snippet of application configuration XML for a managed bean whose class implements Map:
<managed-bean> <managed-bean-name>myBean</managed-bean-name> ... <map-entries> <map-entry> <key>size</key> <value>10</value> </map-entry> <map-entry> <key>color</key> <value>blue</value> </map-entry> </map-entries> ... </managed-bean>
Instances of the bean can referenced in EL like this:
#{myBean.size}
JSF EL tooling will add support for these types of properties. There is also an option to specify the type of either the key or the value or both:
... <map-entries> <key-class>java.lang.String</key-class> <value-class>java.l