Enough theory, let’s write a Struts app. First off, let’s review our MVC Beer app from Chapter 3. The only code that’s going to change when we refactor to Struts is related to the MVC controller. (The model and view are not affected.)
1 Having received a request, the Controller performs validation of the user form data.
2 The Controller invokes the Model component.
3 The Controller forwards to the View.
MVC controller code (from Chapter 3)