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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.