JSR-344
JavaServer Faces (JSF) is a user interface (UI) framework for the development of Java web applications. Its primary function is to provide a component-based toolset for easily displaying dynamic data to the user. It also integrates a rich set of patterns to help manage state and promote code reuse.
JSF 2.2 is activated automatically when any JSF *.xhtml file (referred to as a view) is detected in either the web-root directory, or the WEB-INF/resources/ directory. View files may be placed in subdirectories.
Example /catalog/item.xhtml page:
The above page requires additional functionality for the Expression Language (EL) references, such as viewParam value=”#{catalog.itemId}”, viewAction action=”#{catalog.loadItem}”, and outputText value=”#{catalog.item}”. Below is an example of a CDI managed bean (referred to as a backing bean) that provides the required functionality for the view:
JSF 2.2 introduces Faces Flows, which provide an encapsulation of related pages and corresponding backing beans as a module. This module has well-defined entry and exit points defined by the application developer. Each flow resides in its own folder within the web-root directory, and contains a *-flow.xml file. Flow XML files may be empty if no configuration is required.
Example flow layout:
The newly introduced CDI @FlowScoped annotation defines the scope of a bean in the specified flow. This enables automatic activation/passivation of the bean when the scope is entered/exited:
A new EL object for flow storage, #{flowScope}, is also introduced.
Flows may also be defined as CDI classes with producer methods annotated with @FlowDefinition:
JSF 2.2 defines Resource Library Contracts, a library of templates and associated resources that can be applied to an entire application in a reusable and interchangeable manner. A configurable set of views in the application will be able to declare themselves as template-clients of any template in the resource library contract.
JSF 2.2 introduces passthrough attributes, which allow listing of arbitrary name/value pairs in a component that are passed straight through to the user agent without interpretation by the UIComponent or Renderer.
Example passthrough attribute:
This will cause the following output HTML to be generated:
Public API from javax.faces.*:
@FlowScoped |
CDI scope that associates the bean to be in the scope of the specified Flow. |