Agency Case Study

You will now add a simple servlet to the Agency case study. The servlet lists the contents of an agency database table for display by a browser. The rows of the table are formatted as an HTML table.

The servlet first outputs an HTML form on which the user selects the name of a table from a pull-down list (see Figure 12.19).

Figure 12.19. AgencyTable form.

After the user clicks the Submit Query button, the servlet displays the contents of this table on the same page.

AgencyTable Servlet Code

The AgencyTable servlet overrides the init() method to obtain the servlet context along with the JNDI context for the ...

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.