Sun ONE Application Server 7 Getting Started Guide |
Chapter 5
Becoming Familiar with the Sample ApplicationsThe sample application that you will be using during this guide consists of a web application module and an EJB module containing a single stateless session bean. The web and EJB modules are packaged in an Enterprise Application Archive (EAR) file. Although patterned after more basic “Hello World” applications, this sample displays a greeting based on the user's input and the time of day. Since each greeting is recorded to a database table, the user has the option to list all previously generated greetings as well.
The display greeting path through the application is represented by the yellow numbered steps (1, 2, 3, 4, and 5) in the following diagram, while the greeting log display path through the application is represented by the lettered blue steps (1a, 2a, and 3a) in the diagram.
Figure 5-1 Sample application
When the user accesses the application, the first web page of the application prompts the user to enter a name that will be displayed in a subsequent greeting page.
Figure 5-2 Welcome screen
After entering a name and clicking on the Process button, the following page is displayed with the greeting. In the background, the GreeterDBServlet accessed the stateless session bean to determine the appropriate greeting (“morning”, “afternoon” or “evening”).
The GreeterDBServlet sets the appropriate greeting message in the request object of the servlet request and specifies a JSP to display the result.
Figure 5-3 Greeting
The greeting is displayed.
When the user elects to list all previously generated greetings, the GreeterDBLogDisplayServlet performs a select all on the database table of greetings and specifies a JSP to display the result.
Figure 5-4 Database log
Proceed to Chapter 6, "Setting Up Database Connectivity" to configure the application server’s database setup to support deployment and execution of the sample.