Developing Web 2.0 applications
with JavaServerFaces
and Dreamweaver
>> Just Became Easier
Documentation
Search
  1. Introduction
  2. Getting Started
  3. Developing Web Sites
  4. Using Components
  5. Internationalization
  6. Code View Support
  7. Design View Support
  8. Keyboard Shortcuts
  9. Tag Object Toolbars
  10. JSF Server Behaviors
  11. Property Inspectors
  12. JSF Tag Reference
JSF Core Tag Library
  f:actionListener
  f:ajax
  f:attribute
  f:convertDateTime
  f:convertNumber
  f:converter
  f:event
  f:facet
Selected f:loadBundle
  f:metadata
  f:param
  f:phaseListener
  f:selectItem
  f:selectItems
  f:setPropertyActionListener
  f:subview
  f:validateBean
  f:validateDoubleRange
  f:validateLength
  f:validateLongRange
  f:validateRegex
  f:validateRequired
  f:validator
  f:valueChangeListener
  f:verbatim
  f:view
  f:viewParam
If you like this documentation, please take a look at my book:

12. JSF Core Tag Reference

Documentation > JSF > JSF Tag Reference > JSF Core Tag Library > f:loadBundle

f:loadBundle

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!

JSF Example

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:f="http://java.sun.com/jsf/core" 
      xmlns:h="http://java.sun.com/jsf/html">
<body>
<f:view>
	<f:loadBundle basename="com.mycompany.MessageBundle" var="bundle" />
	<h:outputText value="#{bundle.welcomeMessage}" />
</f:view>
</body>
</html>
This example was formatted by JSFToolbox for Dreamweaver.

com/mycompany/MessageBundle.properties

welcomeMessage=Welcome to our site!

HTML Output

Welcome to our site!

Tag Attributes

basename Text
Required
The basename attribute identifies the base name of the resource bundle to be loaded. JSFToolbox will detect any available message bundles when it scans your site.
var Text
Required
The var attribute sets the name of a request scope attribute under which the resource bundle will be exposed as a Map. You can use value-binding expressions to output message bundle properties in your JSF tags.