Learn Java for Web Development

(Tina Meador) #1
CHAPTER 2: Building Web Applications Using Servlets and JSP 87

Bookstore Application


In the previous chapter, we developed the data-access layer for the bookstore application and
queried it with a stand-alone Java application. In this chapter, we will replace the stand-alone Java
layer with a presentation layer. The data-access layer at the bottom will remain the same,
as illustrated in Figure 2-33.


Figure 2-32. Model-2 architecture


Figure 2-33. Replacing the stand-alone Java client with a presentation layer


In a production-ready application, you should also add a service layer to handle the database
exception. As the application grows, a partitioned application keeps the separation of concerns
clean. Figure 2-34 shows the directory structure of the bookstore application.

Free download pdf