Book Image

Mastering JavaServer Faces 2.2

By : Anghel Leonard
Book Image

Mastering JavaServer Faces 2.2

By: Anghel Leonard

Overview of this book

Table of Contents (20 chapters)
Mastering JavaServer Faces 2.2
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
The JSF Life Cycle
Index

Configuring locales and resource bundles


A properties file that contains messages can be named PlayerMessages.properties. When we have messages in several languages, we can create a properties file for each language and name it accordingly. For example, for English it will be PlayerMessages_en.properties, and for French it will be PlayerMessages_fr.properties. A convenient place to store them is in the application source folder directly or in subfolders (or, in NetBeans, under Other Sources folder in a Maven web application project). A resource bundle is capable of loading and displaying messages from these files.

A resource bundle can be configured locally or globally. A local resource bundle loads the properties file for the specified page only. For this, use the <f:loadBundle> tag as follows:

<f:loadBundle basename="players.msgs.PlayerMessages" var="msg"/>

A global resource bundle loads the properties file for all the JSF pages. In this case, we need a declarative loading in...