private Customer customer = new Customer();
private String[] accountNumbers = null;
private TransRecord[] transactions = null;
private int numberRecords = 0;
public int getNumberRecords() {
return numberRecords;
}
public TransRecord[] getTransactions() {
return transactions;
}
public void setTransactions(TransRecord[] records) {
transactions = records;
numberRecords = transactions.length;
}
log("Customer login");
String result = (new com.ibm.jsf.web.action.ListAccountsAction()).
execute(getCustomerData());
if ( result.equals("success") )
return "success";
else {
log("Error: "+result);
getRequestScope().put("errorMessage", result);
return "error";
}
log(“Account selection: back”);
getSessionScope().remove(“customerData”);
return “home”;
log("Account selection: link");
String accountNumber = (String)getRequestParam().get("selectedAccount");
if (accountNumber == null || accountNumber.equals("")) { javax.faces.application.FacesMessage errmsg =
new javax.faces.application.FacesMessage
(javax.faces.application.FacesMessage.SEVERITY_ERROR,
"No account was selected.",
"No account was selected.");
getFacesContext().addMessage(null, errmsg);
return "stay"; // stay on the list accounts page
}
try {
log("Account selected: "+accountNumber);
getAccount().setId(accountNumber);
(new com.ibm.jsf.web.action.AccountDetailsAction()).execute(getAccount());
} catch (com.ibm.jsf.bank.exception.AccountDoesNotExistException e) {
getRequestScope().put("errorMessage","Account does not exist:"
+accountNumber);
return "error";
} catch (Exception e) {
getRequestScope().put("errorMessage","Exception: "+e.getMessage());
return "error";
}
return "details"; // go to the account details page
package com.ibm.jsf.suggestions;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Set;
public class CustomerIDSuggestions extends AbstractMap {
public Object get(Object key) {
// TODO Auto-generated method stub
int arrayLength = 10;
ArrayList idSuggestions = new ArrayList(arrayLength);
for (int i = 0; i < arrayLength; i++) {
idSuggestions.add("10" + i);
}
return idSuggestions;
}
public Set entrySet() {
// TODO Auto-generated method stub
return null;
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment