Chapter 7. Struts View Components
This chapter introduces the components that make up the view portion of the Struts framework. The framework uses the view components to render dynamic content for the client. Based primarily on JavaServer Pages, the components provide support for internationalization, user-input acceptance, validation, and error handling, making it easier for the developer to focus on business requirements. This chapter concludes the three-part discussion of how the Struts framework implements the MVC pattern.
What Is a View?
In a general sense, a view represents a display of the domain model in a user interface. There can be many different views of the same model. As discussed in Chapter 5, the domain model contains the business entities, which hold the state for the application. Metaphorically speaking, a view is a window that clients can use to look at the state of the model, and the perspective may be different depending on which window a client looks through. For example, in the Storefront application, the front page shows a set of featured items in the catalog. It doesn’t show all of the information about each item, only a small portion. This “summary” view is used in the Storefront application wherever real estate is scarce, such as on the main page (shown in Figure 7-1).
Figure 7-1. The Storefront main page is one perspective of the model
When a user selects ...