30.2 Accessing Databases in Web Apps

Many web apps access databases to store and retrieve persistent data. In this section, we build an address book web app that uses a Java DB database display contacts from the address book on a web page and to store contacts in the address book. Figure 30.1 shows sample interactions with the AddressBook app.

Fig. 30.1 Sample outputs from the AddressBook app.

If the app’s database already contains addresses, the initial request to the app displays those addresses as shown in Fig. 30.1(a). We populated ...

Get Java How to Program (early objects), 9/e 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.