|
The LoadBundle tag loads a resource bundle for the Locale of the current view and stores it as a Map in request scope. This tag is useful for internationalization (I18N) as it allows you to access your message bundle in your JSF page.. The body content of this tag must be empty.
Place this tag above any other component tags on your document (in the head section, for instance) and specify a variable name for the bundle. You can then use value-binding expressions to output localized content on your page.
Note: It is possible, but not recommended, to define resource bundle keys in a properties file that use a dot notation, such as
message.welcome=Welcome to our site!
Athough this is syntax is legal for a Java resource bundle, it is not valid for a JSF message bundle due to expression language parsing. For JSF, the above message
should be defined as follows:
welcomeMessage=Welcome to our site!
Example:
<f:loadBundle basename="com.mycompany.MessageBundle" var="bundle" />
<h:outputText value="#{bundle.welcomeMessage}" />
HTML Output
Welcome to our site!
|