A. Malm điều hành biên tập: Robert Elliott quản lý Sản xuất biên tập: Fred Bernardi Phát triển Editor: Eileen Biên Calabro, Sharon Nash sản xuất biên tập: Felicia Robinson phát triển truyền thông Chuyên: Greg Stafford Tiêu đề Thiết kế & Thành phần: | JSF Patterns and Architecture 23 rules and other elements in a JSF configuration file see Chapter 4 JSF Configuration. We ll talk about how you bind an action to a user interface component shortly when we visit the JSF View. Before we do that let s take a look at the JSF Model. Model When thinking in terms of existing Web frameworks like Struts it may be a little confusing at first to see a JSF component s data referred to as the Model. This distinction becomes more difficult in JSF because we now have components similar to what we find in Swing. In reality what is called a Model in JSF is often similar to a Struts ActionForm that stores and marshals data between the View and Model layers of a Web application. This is a very important distinction. Whether or not you decide to use business objects directly to back your user interface components you must resist the temptation to let JSF component data objects influence your real Model business objects and vice versa. Failing to do so often results in high coupling between the View and Model layers of the Model-2 architecture. There are some even among the authors of this book who prefer to use business objects to negate the need for a separate set of objects just for the user interface components. In fact there have been several heated debates in the Struts community alone regarding this preference. As long as you understand the tendency for business object models to be corrupted by such a direct connection and the separation of Model and View to become blurred you may certainly do as you wish. Just be aware of the consequences. That being said when thinking strictly in terms of UI components dubbing a component s backing data the Model makes more sense. This is especially true when coming from Swing. So the whole debate over whether or not a component s data is the Model or not is really just based on your point of reference. Just make sure that you are aware of this distinction so you can avoid some of the pitfalls