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.

This chapter also briefly discusses the up-and-coming JavaServer Faces specification. Although it’s still in early draft form, this specification is likely to impact the Struts framework.

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 ...

Get Programming Jakarta Struts now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.