2. Understanding Java Platform, Enterprise Edition
3. Creating Your First Java EE Application
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
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
Configuring the Resource Bundle in the Configuration File
Creating the DukesBDay Managed Bean Class
Add an Enterprise Bean Reference
Get the Age Difference from the DukesBirthdayBean Enterprise Bean
Resource Libraries in firstcup
The inputDate Composite Component
Create the inputDate Composite Component
Set the Welcome File in the web.xml Deployment Descriptor
Add the Form to greeting.xhtml
Building, Packaging, Deploying, and Running the firstcup Web Application
Build, Package, and Deploy the firstcup 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.
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Legal Notices
Scripting on this page tracks web page traffic, but does not change the content in any way.