Your First Cup: An Introduction to the Java EE Platform

ProcedureConfiguring the Resource Bundle

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.

  1. With the newly created faces-config.xml file open, click XML.

  2. Add the following <application> tag to configure the resource bundle:


    <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.

  3. Right-click in the editor window and select Format.

  4. Select File -> Save.