6.10.  < a4j:loadBundle >

6.10.1. Description

The <a4j:loadBundle> component is similar to the same component from the JSF Core library. The component loads a resource bundle localized for the Locale of the current view and exposes it (as a Map) in the request attributes of the current request.

Table 6.19. a4j : loadBundle attributes

Attribute NameDescription
basenameBase name of the resource bundle to be loaded.
bindingThe attribute takes a value-binding expression for a component property of a backing bean
idEvery component may have a unique id that is automatically created if omitted
renderedIf "false", this component is not rendered
varName of a request scope attribute under which the resource bundle will be exposed as a Map.

Table 6.20. Component identification parameters

NameValue
component-typeorg.ajax4jsf.Bundle
component-familyorg.ajax4jsf.Bundle
component-classorg.ajax4jsf.component.html.AjaxLoadBundle

6.10.2. Creating on a page

To create the simplest variant on a page use the following syntax:

Example:


<a4j:loadBundle baseName="demo.bundle.Messages" var="Message"/>

6.10.3. Creating the Component Dynamically Using Java

Example:


import org.ajax4jsf.component.html.AjaxLoadBundle;
...
AjaxLoadBundle myBundle = new AjaxLoadBundle();
...
        

6.10.4. Key attributes and ways of usage

<a4j:loadBundle> allows to use reference to bundle messages during the Ajax re-rendering. <a4j:loadBundle> is a substitute for the <f:loadBundle> in JSF 1.1 which is not a JSF component originally. <f:loadBundle> is a jsp tag that load the bundle messages into the request scope when page is rendered. As soon as each Ajax request works in own request scope, the bundles loaded with <f:loadBundle> are unavailable. Instead of <f:loadBundle> that might be located anywhere on a page, the <a4j:loadBundle> should be declared inside the <f:view> (this does not matter in case on using Facelets) JSF 1.2 introduces the bundle registered in the faces-config.xml. This fixed the problem with <f:loadBundle> . Therefore, you can use this JSF 1.2 way to declare your bundles.

6.10.5. Relevant resources links

Here you can found some additional information for <a4j:loadBundle> component usage.

Here you can found some additional information about <f:loadBundle> component.

Here you can found some additional information about <f:view> component.