Home

 

Running the Struts Web application

In this section we run the sample application and explore the functionality built using Application Developer and its support for rapid development of Struts-based Web applications.

To run the sample ITSO Bank application, do these steps:

Start the WebSphere Application Server v7.0 if it is not running.

Expand RAD75StrutsWeb Æ WebContent, right-click the logon.jsp and select Run | s Æ Run on Server.

In the Server Selection wizard select Choose and existing server, select the WebSphere Application Server v7.0 server, select Always use this server when running this project, and click Finish.

The home page logon.jsp is displayed (Figure | 5-18).

Figure 15-18 Running the sample: Logon.jsp

If you click Submit without entering an ID, the Struts Validation Framework is activated and displays the error message from the resources:

Verify that the customer ssn entered is correct

Enter a sample ID of 111-11-1111 and click Submit. The customer and a list of accounts is displayed (Figure | 5-19).

Figure 15-19 Running the sample: Account listing

Here the logon action is responsible for retrieving this information. In a real world application, the logon action talks to the business tier to retrieve this information. The business tier architecture is described in detail in Chapter | 4, Developing EJB applications

To view details of a particular account, click the Account Number (for example, 001-999000777) and the account information is listed. At this point there might be no transactions (Figure | 5-20).

Figure 15-20 Running the sample: Account details

To perform a transaction on the account, click Deposit/Withdraw. The link is also available in the account listing (click back to get to the listing again).

The transaction page is displayed. Enter a positive number for a deposit and a negative number for a withdrawal. We enter in 55.55 to indicate a deposit and click Submit (Figure | 5-21).

Figure 15-21 Running the sample: Performing transactions

The Account Details page is redisplayed with the updated balance and an entry made for the last transaction (Figure | 5-22).

Figure 15-22 Running the sample: Transaction listing

Run a few more transactions and the list of transaction grows (Figure | 5-23).

Figure 15-23 Running the sample: More transactions

Enter an invalid amount (for example, alphabetic) or a withdraw amount greater than the balance, and you get the exception error:

Verify that the amount entered is valid.

Use the back and logoff links to go back to the logon panel.
ibm.com/redbooks