Document Information

Preface

Part I Introduction

1.  Overview

2.  Using the Tutorial Examples

Part II The Web Tier

3.  Getting Started with Web Applications

4.  Java Servlet Technology

5.  JavaServer Pages Technology

6.  JavaServer Pages Documents

7.  JavaServer Pages Standard Tag Library

8.  Custom Tags in JSP Pages

9.  Scripting in JSP Pages

10.  JavaServer Faces Technology

11.  Using JavaServer Faces Technology in JSP Pages

12.  Developing with JavaServer Faces Technology

13.  Creating Custom UI Components

14.  Configuring JavaServer Faces Applications

Application Configuration Resource File

Configuring Beans

Using the managed-bean Element

Initializing Properties Using the managed-property Element

Referencing a Java Enum Type

Referencing an Initialization Parameter

Initializing Map Properties

Initializing Array and List Properties

Initializing Managed Bean Properties

Initializing Maps and Lists

Registering Custom Error Messages

Registering a Custom Validator

Registering a Custom Converter

Configuring Navigation Rules

Registering a Custom Renderer with a Render Kit

Registering a Custom Component

Basic Requirements of a JavaServer Faces Application

Configuring an Application with a Deployment Descriptor

Identifying the Servlet for Life Cycle Processing

Specifying a Path to an Application Configuration Resource File

Specifying Where State Is Saved

Encrypting Client State

Restricting Access to JavaServer Faces Components

Turning On Validation of XML Files

Verifying Custom Objects

Including the Required JAR Files

Including the Classes, Pages, and Other Resources

15.  Internationalizing and Localizing Web Applications

Part III Web Services

16.  Building Web Services with JAX-WS

17.  Binding between XML Schema and Java Classes

18.  Streaming API for XML

19.  SOAP with Attachments API for Java

Part IV Enterprise Beans

20.  Enterprise Beans

21.  Getting Started with Enterprise Beans

22.  Session Bean Examples

23.  A Message-Driven Bean Example

Part V Persistence

24.  Introduction to the Java Persistence API

25.  Persistence in the Web Tier

26.  Persistence in the EJB Tier

27.  The Java Persistence Query Language

Part VI Services

28.  Introduction to Security in the Java EE Platform

29.  Securing Java EE Applications

30.  Securing Web Applications

31.  The Java Message Service API

32.  Java EE Examples Using the JMS API

33.  Transactions

34.  Resource Connections

35.  Connector Architecture

Part VII Case Studies

36.  The Coffee Break Application

37.  The Duke's Bank Application

Part VIII Appendixes

A.  Java Encoding Schemes

B.  About the Authors

Index

 

Registering Custom Localized Static Text

Any custom localized static text you create that is not loaded into the page using the loadBundle tag must be registered with the application using the resource-bundle element in the application configuration resource file for your pages to have access to the text. Likewise, any custom error messages that are referenced by the converterMessage, requiredMessage, or validatorMessage attributes of an input component tag must also be made available to the application by way of the loadBundle tag or the resource-bundle element of the application configuration file.

Here is the part of the file that registers some custom error messages for the Duke’s Bookstore application:

<application>
    ...
    <resource-bundle>
        <base-name>
            com.sun.bookstore6.resources.CustomMessages
        </base-name>
        <var>customMessages</var>
    </resource-bundle>    
    ...
</application>

Similarly to the loadBundle tag, the value of the base-name subelement specifies the fully-qualified class name of the ResourceBundle class, which in this case is located in the resources package of the application.

Also similarly to the var attribute of the loadBundle tag, the var subelement of the resource-bundle element is an alias to the ResourceBundle class. This alias is used by tags in the page to identify the resource bundle.

The locale-config element shown in the previous section also applies to the messages and static text identified by the resource-bundle element. As with resource bundles identified by the message-bundle element, make sure that the resource bundle identified by the resource-bundle element actually contains the messages for the locales that you specify with these locale-config elements.

To access the localized message, the page author uses a value expression to reference the key of the message from the resource bundle. See Performing Localization for more information.