Home

 

Implementing the UpdateCustomer servlet

The UpdateCustomer servlet is used for updating the customer information and is invoked from the ListAccounts JSP through a push button.

The servlet requires that the SSN of the customer that is to be updated is already placed on the session (as should be done in the ListAccounts servlet). It extracts the title, firstName, and lastName parameters from the HttpRequest object, calls the bank.getCustomer(String customerNumber) method and then uses the simple setters on the Customer class to update the details.

Follow the procedures described in Adding the ListAccounts servlet to the Web project and Implementing the ListAccounts servlet for building the servlet, including the doGet and doPost methods. The code to use for this class is in:

c:\7672code\webapp\servlet\UpdateCustomer.java
ibm.com/redbooks