To make the resource bundle available to the application, you need to configure it in the configuration file, by performing the following task.
By default, NetBeans 6.7 IDE creates a Facelets 1.2 configuration file. Modify the faces-config.xml to set the Facelets version to 2.0.
Expand the firstcup module, then Configuration Files in the Projects pane.
Double-click faces-config.xml.
Click XML.
Replace the opening <faces-config> tag with the following:
<faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" version="2.0">
Select File->Save.
The firstcup application is localized for English and Spanish languages. JavaServer Faces applications can automatically select the proper language based on the locale of the user's web browser. Specify the default and supported locales in the faces-config.xml file.
In faces-config.xml add an <application> tag with the following:
<application> <resource-bundle> <base-name>firstcup.web.WebMessages</base-name> <var>bundle</var> </resource-bundle> <locale-config> <default-locale>en</default-locale> <supported-locale>es</supported-locale> </locale-config> </application> |
The base-name element of the resource-bundle element identifies the fully-qualified class name of the resource bundle. The var element identifies the name by which the XHTML pages will reference the resource bundle. The locale-config element identifies the locales supported by the resource bundle.
Select File->Save.