Each of the architectures discussed in this chapter will be based on one of these approaches:
- The first method is referred to here as the page-centric (or Client-Server) approach. This approach involves request invocations being made directly to JSP page.
- In the second method, the dispatcher (or N-tier) approach, a basic Servlet or JSP acts as a mediator or controller, delegating requests to JSP pages and JavaBeans.
We will examine these approaches in light of a simple example, which will evolve to satisfy the requirements of various scenarios. The initial scenario involves providing a web interface for guessing statistics about a soon-to-be-born baby. The guesses are stored, and can be reviewed later by the parents, to see who has guessed the closest. As the requirement scenarios become more sophisticated, such as adding the desire for a persistence mechanism, the solution scenarios will become more sophisticated, as well. Thus, our example will evolve and we will gain an understanding of how the various architectures that we discuss will help us build a system that satisfies these requirements in an elegant and effective manner.
Let’s look at some examples of architectures that utilize these approaches and discuss the tradeoffs and usage.