Architecture of the Example Application
The example application consists of three main components: DukesAgeService, a web service endpoint; DukesBirthdayBean, an enterprise bean; and firstcup, a web application created with JavaServer Faces technology.
DukesAgeService is a JAX-WS endpoint that calculates the age of Duke, the Java mascot. Duke was born on May 23, 1995, when the first demo of Java technology was publicly released.
DukesBirthdayBean is a stateless session bean that calculates the difference between the user's age and Duke's age.
The firstcup web application is a JavaServer Faces application that accesses DukesAgeService to display Duke's age, reads in a date provided by the user, accessesDukesBirthdayBean to calculate who is older, and then displays the difference in years between the user and Duke.
The web application consists of the following:
greeting.jsp: A JSP page with which a user can enter a date.
response.jsp: A JSP page that tells the user whether he or she is older or younger than Duke, based on the date the user entered in the greeting.jsp page.
DukesBDay.java: A JavaServer Faces managed bean that defines properties to hold the user's birth date, get Duke's current age from the web service, and get the age difference between the user and Duke from the enterprise bean.
faces-config.xml: A file used to configure resources for the JavaServer Faces application. In the case of this application, the file configures a resource bundle containing messages, the managed bean, DukesBDay, and the page navigation rules.
web.xml: The web application's deployment descriptor, which is used to configure certain aspects of a web application when it is installed. In this case, it is used to provide a mapping to the application's FacesServlet instance, which accepts incoming requests, passes them to the life cycle for processing, and initializes resources.
Tiers in the Example Application
The example application has one web tier component (the firstcupweb client) and two business tier components (the DukesAgeServiceweb service and the DukesBirthdayBeanenterprise bean). The user's web browser is the client tier component, as it accesses the rest of the application through the web tier. The example application does not access the EIS tier.
Java EE Technologies Used in the Example Application
The DukesAgeService web service endpoint is a JAX-WS endpoint The DukesBirthdayBean enterprise bean is a stateless session bean. The firstcupweb client is a JavaServer Faces application that runs in the web container of the Java EE server.