As luck would have it, the very same pattern we’ve been using in the book is on the exam. The last two patterns we’re covering are presentation tier patterns, as was the Intercepting Filter. First we’ll pick up where we left off talking about MVC. That discussion will lead us into Struts and finally Front Controller.
Let’s do a quick review of where we left off in Chapter 2.
Holds the real business logic and the state. In other words, it knows the rules for getting and updating state.
A Shopping Cart’s contents (and the rules for what to do with it) would be part of the Model in MVC.
It’s the only part of the application that talks to the database.
Takes user input from the request and figures out what it means to the model.
Tells the model to update itself, makes the model state available for the view (the JSP) and forwards to the JSP.
Responsible for the presentation. It gets the state of the model from the Controller (although not directly; the Controller puts the model data in a place where the View can find it).
Off Track: GUI MVC vs Web MVC
MVC existed before the World Wide Web came along. In its first incarnation, MVC was a design to simplify complex GUI applications. First created in Smalltalk, one of MVC’s chief attributes was that the View would be notified automatically of changes to the Model.