Utility class emulating the behavior of the standard JSF Core Library tag <f:loadBundle>. This class is designed to be used as a managed bean, and exposes a map property containing the messages in the resoruce bundle specified by the basename property, localized for the Locale specified on the current request.
A typical use of this class would be to declare a managed bean like this:
<managed-bean> <managed-bean-name>bundle</managed-bean-name> <managed-bean-class> org.apache.shale.util.LoadBundle </managed-bean-class> <managed-bean-scope>request</managed-bean-scope> <managed-property> <property-name>basename</property-name> <value>com.mycompany.mypackage.Bundle</value> </managed-property> </managed-bean>
This will result in creation of a request scope object whose map property will return a Map representing the localized messages for the com.mycompany.mypackage.Bundle resource bundle. You can look up localized messages in this Map by evaluating a value binding expression like this:
#{messages.['message.key']} where message.key is the key for which to retrieve a localized message.
(Since 1.0.1) IMPLEMENTATION NOTE - For backwards compatibility in applications that utilized the 1.0.0 version of this class, the following sort of expression resolves to the same value:
#{messages.map['message.key']}
| |
| |
| |