Exercises

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

  1. Extend the Agency case study Web interface. 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 email 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 to display the contents of the Customer table. Remember to ensure that you protect access to shared instance variables (such as references to the Agency and Customer EJBs) inside synchronized blocks.

  2. Now add a new servlet to delete a customer. The only information you will ...

Get Sams Teach Yourself J2EE™ in 21 Days, Second Edition 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.