Document Information

Preface

1.  Introduction

2.  Understanding Java Platform, Enterprise Edition

3.  Creating Your First Java EE Application

Creating the firstcup Project

Create the Web Application Project

Creating the Java Persistence API Entity

Create the FirstcupUser Entity Class

Add Properties to the FirstcupUser Entity

Add Constructors to the FirstcupUser Entity

Add a Named Query to the FirstcupUser Entity

Creating the Enterprise Bean

Create the DukesBirthdayBean Enterprise Bean Class

Add a Logger Instance to DukesBirthdayBean.java

Add a Business Method to DukesBirthdayBean that Gets the Average Age Difference of firstcup Users

Add a Business Method for Calculating the Age Difference Between Duke and the User

Creating the Web Client

Creating a Resource Bundle

Create a Resource Bundle

Configuring the Resource Bundle in the Configuration File

Create a Configuration File

Configure the Resource Bundle

Creating the DukesBDay Managed Bean Class

Create the Managed Bean Class

Add an Enterprise Bean Reference

Add Properties to the Bean

Get the Age Difference from the DukesBirthdayBean Enterprise Bean

Creating the Facelets Client

Resource Libraries in firstcup

The inputDate Composite Component

Create the inputDate Composite Component

The Facelets Web Interface

Create the XHTML Files

Set the Welcome File in the web.xml Deployment Descriptor

Modify the XHTML Files

Add the Form to greeting.xhtml

Add the Form to response.html

Building, Packaging, Deploying, and Running the firstcup Web Application

Build, Package, and Deploy the firstcup Web Application

Run the firstcup Application

5.  Next Steps

 

Chapter 4
Creating Your Second Web Application

This chapter gives step-by-step instructions on coding and running the firstcup web application, which uses the dukes-age web service described in Chapter 3, Creating Your First Java EE Application. The firstcup web application is a more complicated application, and uses several different Java EE APIs.

The firstcup example application retrieves, or “consumes,” the data from the dukes-age web service. A JavaServer Faces web front-end asks users to enter their birthdays to find out who is older, the user or Duke. This data is stored in a Java DB database table using the Java Persistence API. The business logic, which provides the core functionality of the application, is handled by an enterprise bean.

All the tiers described in Tiered Applications are present in the firstcup web application. The web or client tier is the JavaServer Faces front-end. The enterprise information systems, or EIS, tier is the Java DB database. The business tier is the enterprise bean.