Java Reference
In-Depth Information
</managed-property>
...
</managed-bean>
To access the area code at the time the page is rendered, refer to the property from the
area
component tag's
value
attribute:
<h:inputText id=area value="#{customer.areaCode}"
Values are retrieved from other implicit objects in a similar way.
Initializing Map Properties
The
map-entries
element is used to initialize the values of a bean property with a type
of
java.util.Map
if the
map-entries
element is used within a
managed-prop-
erty
element. A
map-entries
element contains an optional
key-class
element, an
optional
value-class
element, and zero or more
map-entry
elements.
Each of the
map-entry
elements must contain a
key
element and either a
null-
value
or
value
element. Here is an example that uses the
map-entries
element:
<managed-bean>
...
<managed-property>
<property-name>prices</property-name>
<map-entries>
<map-entry>
<key>My Early Years: Growing Up on *7</key>
<value>30.75</value>
</map-entry>
<map-entry>
<key>Web Servers for Fun and Profit</key>
<value>40.75</value>
</map-entry>
</map-entries>
</managed-property>
</managed-bean>
The map created from this
map-entries
tag contains two entries. By default, all the
keys and values are converted to
String
. If you want to specify a different type for the
keys in the map, embed the
key-class
element just inside the
map-entries
ele-
ment: