However, the first generation of JSF (called JSF 1) has been criticized for its steep learning curve,
complexity in building custom components, and lack of support for Ajax. JSF 2 greatly simplifies the
model, as well as provides out-of-the-box support for Ajax.
JSF is the standard view technology within the JEE stack, so every major JEE application server
vendor (for example, JBoss, IBM, Oracle, and so on) supports JSF and ships with its own JSF component
library. Furthermore, there are a lot of open source and commercial projects that provide JSF
component libraries, such as JBoss RichFaces, PrimeFaces, ICEfaces, and so on.
JSF mainly consists of four components: the view, model interaction, navigation, and life cycle.
These four components will be discussed in the following sections.
View
In JSF, as with the MVC pattern, a view is a page that presents data to the user. However, because JSF is a
component-based framework, a view is represented by a tree of UI components, which are exposed in
the view as markup tags. The UI component hierarchy is represented by nesting tags.
As of JSF 2, Facelets is the standard technology for all JSF pages. Facelets, which adopts the XHTML
syntax, provides built-in support of page templating, without the need of other templating frameworks
like Apache Tiles.
Model Interaction
In JSF, the view stores a tree of UI components with values and provides user interactions. When a user
takes an action, the request will be submitted to the server for processing. On the server side, the values
in the UI component tree will be transformed back into the model for processing. This process
represents the action between the UI components and the underlying model.
In JSF 2, the JSF 2.0 Expression Language (EL) is used for referencing model objects from UI
components. When the response is rendered to the user, the UI components get their values from the
associated model properties. During the interaction, type-safe conversion and server-side validation
occur automatically.
To support highly interactive web pages in JSF, model objects are usually implemented as "backing
beans" on a page basis. In this case, the model object represents the state of the model properties stored
by the view. In managing those beans, JSF also adopts the concept of IoC, and they are called JSF
Managed Beans, which can be defined in the JSF config files (called faces-config.xml) or by using
annotations. However, JSF's EL allows integration with technologies outside JSF. For example, when
using JSF with Spring Web Flow, the standard Spring beans can be used as JSF managed beans, using the
standard DI mechanism provided by the Spring Framework.
Navigation
JSF provides a framework for defining page navigation rules. For example, in a view, when a user
performs an action, the request is submitted to the server. On the server side, an "action controller"
will process the request by interacting with the service layer, and then depending on the outcome and
the navigation rules defined in the faces-config.xml file, the corresponding view will be displayed to
the user.
However, when using Spring Web Flow, the JSF navigation mechanism is not required. As described
in the section "Spring Web Flow Features" earlier in this chapter, Spring Web Flow provides built-in
support for flow definition, which can replace the navigation model provided by JSF.
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home