Application Architecture Example

In this chapter, we build an employee register application. This application contains functions for adding and changing employee information, as well as for looking up employees matching a search criterion. The employee information is stored in a relational database and accessed through the JSTL database access actions.

The employee registration part of the application contains the pages shown in Figure 12-1.

Employee registration pages
Figure 12-1. Employee registration pages

This example looks similar to the example from Chapter 10. The enter.jsp page presents a form in which the user enters information about an employee. When the form is submitted, it invokes the validate.jsp page, where all input is validated. If the input is invalid, the request is forwarded back to the enter.jsp page to display error messages and the form with all the values the user previously entered. The user can then correct the invalid values and submit the form again. When all input is valid, the validate.jsp page forwards the request to the store.jsp page where the information is stored in the database. Finally, the store.jsp page redirects to the confirmation.jsp page, which displays the information actually stored in the database as a confirmation to the user.

Figure 12-2 shows the pages used to implement the employee search function.

Figure 12-2. Employee search pages

The search.html page is ...

Get JavaServer Pages, 3rd 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.