A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.oracle.com/javaee/7/tutorial/dukes-bookstore002.htm below:

57.2 The Duke's Bookstore Interface

57.2 The Duke's Bookstore Interface

This section provides additional detail regarding the components of the Duke's Bookstore example and how they interact.

57.2.1 The Book Java Persistence API Entity

The Book entity, located in the dukesbookstore.entity package, encapsulates the book data stored by Duke's Bookstore.

The Book entity defines attributes used in the example:

The Book entity also defines a simple named query, findBooks.

57.2.2 Enterprise Beans Used in Duke's Bookstore

Two enterprise beans located in the dukesbookstore.ejb package provide the business logic for Duke's Bookstore.

57.2.3 Facelets Pages and Managed Beans Used in Duke's Bookstore

The Duke's Bookstore application uses Facelets and its templating features to display the user interface. The Facelets pages interact with a set of CDI managed beans that act as backing beans, providing the underlying properties and methods for the user interface. The front page also interacts with the custom components used by the application.

The application uses the following Facelets pages, which are located in the tut-install/examples/case-studies/dukes-bookstore/src/main/webapp/ directory.

The application uses the following managed beans, which are located in the tut-install/examples/case-studies/dukes-bookstore/src/main/java/javaeetutorial/dukesbookstore/web/managedbeans/ directory.

57.2.4 Custom Components and Other Custom Objects Used in Duke's Bookstore

The map and area custom components for Duke's Bookstore, along with associated renderer, listener, and model classes, are defined in the following packages in the tut-install/examples/case-studies/dukes-bookstore/src/main/java/javaeetutorial/dukesbookstore/ directory.

The tut-install/examples/case-studies/dukes-bookstore/src/java/dukesbookstore/ directory also contains a custom converter and other custom listeners not specifically tied to the custom components.

57.2.5 Properties Files Used in Duke's Bookstore

The strings used in the Duke's Bookstore application are encapsulated into resource bundles to allow the display of localized strings in multiple locales. The properties files, located in the tut-install/examples/case-studies/dukes-bookstore/src/main/java/javaeetutorial/dukesbookstore/web/messages/ directory, consist of a default file containing English strings and three additional files for other locales. The files are as follows:

The language setting in the user's web browser determines which locale is used. The html tag in bookstoreTemplate.xhtml retrieves the language setting from the language property of LocaleBean:

<html lang="#{localeBean.language}"
...

For more information about resource bundles, see Chapter 20, "Internationalizing and Localizing Web Applications."

The resource bundle is configured as follows in the faces-config.xml file:

<application>
    <resource-bundle>
        <base-name>
            javaeetutorial.dukesbookstore.web.messages.Messages
        </base-name>
        <var>bundle</var>
    </resource-bundle>
    <locale-config>
        <default-locale>en</default-locale>
        <supported-locale>de</supported-locale>
        <supported-locale>es</supported-locale>
        <supported-locale>fr</supported-locale>
    </locale-config>
</application>

This configuration means that in the Facelets pages, messages are retrieved using the prefix bundle with the key found in the Messages_locale.properties file, as in the following example from the index.xhtml page:

<h:outputText style="font-weight:bold" 
              value="#{bundle.ChooseBook}" />

In Messages.properties, the key string is defined as follows:

ChooseBook=Choose a Book from our Catalog
57.2.6 Deployment Descriptors Used in Duke's Bookstore

The following deployment descriptors are used in Duke's Bookstore:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4