Document Information


1.  Introduction

2.  Understanding Java Platform, Enterprise Edition

3.  Creating Your First Java EE Application

4.  Creating Your Second Web Application

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

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


Creating the firstcup Project

The firstcup web application project consists of the Java Persistence API entity, the enterprise bean, and the JavaServer Faces web front-end.

Create the Web Application Project

Follow these steps to create a new web application project in NetBeans IDE.

  1. From the File menu, choose New Project.
  2. In the Categories pane, select Java Web.
  3. In the Projects pane, select Web Application.
  4. Click Next.
  5. In the Project Name field, type firstcup.
  6. In the Project Location field, browse to tut-install/myexample, where tut-install is the location of the firstcup tutorial installation.
  7. Click Next.
  8. Select your GlassFish Server instance from the Server menu.
  9. Make sure Java EE 6 Web is selected in the Java EE Version menu.
  10. Check the Enable Contexts and Dependency Injection box.
  11. In the Context Path field, makes sure it is set to /firstcup.
  12. Click Next.
  13. Under Frameworks, select JavaServer Faces.
  14. Click Finish.
  15. From the Projects tab, right-click the index.xhtml file and select Delete. Click Yes in the dialog.