Home
Studying the sample code
Study the sample code, especially the actions and the JSPs:
The Java classes with the transfer beans and action forms are easy to understand, they are standard Java beans.
The AccountDetailsAction retrieves one customer account and the transactions of that account and stores the data in the data transfer beans.
The PerfomTransactionAction adds or subtracts the transaction amount from the balance. The logic for this is handled in the imported Java project on the ITSOBank class in the package itso.rad75.bank.impl.
Note: For more information about the RAD75Java project logic, refer to the Chapter | , Developing Java applications.
The customerListing.jsp displays the customer name and the list of accounts; for that, several Struts tags are used:
Additional tag library: <%@taglib uri="http://struts.apache.org/tags-logic"
prefix="logic"%>
Note: With Struts 1.3.8, the uri attribute in the JSP tags is changed:
from: http://jakarta.apache.org/struts/tags-***to: | http://struts.apache.org/tags-***.
<bean:write>: display data from a JavaBean: <bean:write name="customer" scope="request" property="firstName" />
<html:link>: An HTML link to another Web page or action: <html:link action="/logoff">logoff</html:link>
<html:link page="/transact.jsp" name="queryParms"> Deposit/Withdraw
</html:link>
Parameters for the link (accountId, balance) are stored in a HashMap.
<logic:present>: Verify and retrieve session and request data: <logic:notPresent name="ssn" scope="session">
<logic:redirect page="/logon.jsp" />
<logic:present name="ssn" scope="session">
<logic:present name="customer" property="accounts" scope="request">
<logic:iterate>: Loop over a property: <logic:iterate name="customer" property="accounts" scope="request"
id="account">
The accountDetails.jsp displays the account information and the list of transactions of that account:
<bean:message>: Retrieve a text from the application resource file: <bean:message key="form.accountId" />
<nested> tags: Nested loops <nested:iterate name="account" property="transactions" id="transaction">
<nested:present name="account" property="transactions">
<bean:write name="transaction" property="timeStamp"/>
The transact.jsp displays the account information and a form to submit a transaction amount for deposit or withdraw.
The error.jsp displays the Struts errors.
ibm.com/redbooks