As we’ve just seen, the JSF configuration file has two main sections—one for navigation rules and one for bean definitions. The JSF framework relies on managed beans to glue the user interface (defined primarily in JSP using the JSF tag libraries) to the business logic of your application (which can be whatever sort of code you want).
Managed beans are simply regular Java beans, configured within
the faces-config.xml file. The bean class follows
the standard JavaBeans rules—a zero-parameter constructor and a set of
get/set methods for manipulating properties. In JSF, managed beans
also contain action methods . Action methods are invoked by the JSF framework in
response to a user action or an event and contain the code that
actually manipulates the data model behind your application. In
Struts, these methods would correspond to the
Action classes that drive the
A JSF application usually has two types of managed
beans—model beans and backing beans . The difference between the two is more architectural
than technical. Model beans focus on integration with the data model
of the application. In the Library application, we have model beans
com.oreilly.jent.jsf.library.model package) for tasks like managing the book collection itself and for keeping track of user accounts and privileges. Backing beans are linked more directly to the structure of the user interface. A backing bean contains action methods that manipulate the model beans on behalf ...