Exercises

To extend your knowledge of Servlets, try the following exercise.

  1. Extend the Agency case study. Add a servlet that produces a page that can be used to add new customers to the database. The information you will need to collect is the applicant's name, login, and e-mail address. Use the agency.createCustomer() method to store this information in the Customer table in the database. Check that your servlet works correctly by running your AgencyTableServlet and to display the contents of the Customer table.

  2. Now add a new servlet to delete a customer. The only information you will need to obtain is the login name. Use the agency.deleteCustomer method. Again, check that your servlet works correctly by running your AgencyTableServlet.

Get Sams Teach Yourself J2EE™ in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.