Home

 

ITSO Bank Struts Web application overview

We use the ITSO Bank as the theme of our sample Web application using Struts. Similar samples were developed in the following chapters using other Web application technologies:

Chapter | 3, Developing Web applications using JSPs and | ervlets

Chapter | 6, Developing Web applications using JSF

The ITSO Bank sample application allows a customer to enter a customer ID (social security number), select an account to view detailed transaction information, or perform a deposit or withdrawal on the account. The model layer of the application is implemented within the action classes using Java beans for the sake of simplicity.

In the banking sample, we use the Struts framework for the controller and view components of the Web application. To start, we implement the model using the in-memory implementation provided by the RAD75Java project developed in Chapter | , Developing Java applications.

Figure | 5-3 displays the Struts Web Diagram for the sample banking application. The basic description and flow of the banking sample application are as follows:

The logon.jsp page is displayed as the initial page of the banking sample application. The customer is allowed to enter their social security number.
In our case, we use simple validation of the Struts framework to check for an empty value. If the customer does not enter a valid value, the Struts framework returns to the logon.jsp page and display the appropriate message to the user.

The logon action logs in the user, and on successful logon retrieves the customer and the account information and lists all the accounts associated with the customer using the customerlisting.jsp Web page.

In the customerlisting.jsp, the customer can select to see details of an account using the accountDetails action, or perform a transaction on an account using the transact.jsp.

In the accountDetails.jsp, the details of the account are displayed, including the transactions that have been performed on the account. The customer can select to perform another transaction using the transact.jsp.

The transact.jsp invokes the performTransaction action. After a successful transaction, the accountDetails action is invoked to redisplay the accountDetails.jsp.

The customer can log off using the logoff link, which invokes the logoff action.

In case of errors, an error.jsp is displayed.

Figure 15-3 Struts Web Diagram: ITSO Bank sample

In this section we focus on creating the various Struts components, including the Struts controller, actions, action forms, and Web pages, and relate these components together. We implement the following steps to demonstrate the capabilities of Application Developer:

Create a dynamic Web application with Struts support: In this section the process of creating a dynamic Web application with Struts support and the wizard generated support for Struts is described.

Create Struts components: In this section we focus on creating Web pages, actions, action forms, exceptions (local and global), and forwards using the Web Diagram, and modify the properties of Struts components using the Struts Configuration Editor.

Struts Configuration Editor: In this section we focus on creating Struts components using the Struts Configuration Editor that provides a visual editor to modify the Struts configuration file struts-config.xml.

Import the complete sample banking Web application: In the previous sections we created various Struts components. Here we import the complete banking sample implemented as shown in Figure | 5-3.

Run the sample banking application: In this section we verify the data source configurations in the extended application descriptor of the imported sample and then run and test the application in the WebSphere V7.0 Test Environment.

Note: Because this chapter focuses on RAD's Struts tools and wizards (more than on the architecture and best practices of a Struts application), we try to use the Struts tools and wizards as much as possible when creating our application.

After having used the wizards to create some components (JSPs, form beans, actions), you might find it faster to create new components by copying and pasting from your existing components than by using all the wizards.

ibm.com/redbooks