Handling Command Submissions: Design Details

This solution is illustrated by the command submissions application available under the bpcatalog project hosted at java.net. This application is a simple web application that is written using JavaServer[TM] Faces technology. It presents a simple UI that illustrates various strategies for handling command submissions. The following screen shot shows the main page.

Main Page for the Command Submissions JSF application

When you click the Show More Details button, the Address text box displays. After you click the Hide Details button, the Address text box disappears.

The application consists of two major entities:

The diagram below illustrates the relationship between these two major entities.

UML Diagram for Command Submissions

The CommandSubmissionBean shows how the action listener is implemented. The Main Page, index.jsp, illustrates how an action as well as action listener is specified. The Guest Login button results in a static action. The Login button results in a call to the login action method. The Show More Details button changes its label to Show More Details or Hide More Details, depending on the current context. Because this button needs to know what is contained in its label to decide what action to take, it is an ideal candidate for using an action listener.


© Sun Microsystems 2005. All of the material in The Java BluePrints Solutions Catalog is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.