Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the definition of "component" in JSF

Tags:

java

jsf

What is the definition of "component" in JSF 2.0?

What is the definition of component in Facelets used in JSF 2.0?

Of course I googled for it but I did not find a short and clear answer.

like image 742
Dima Avatar asked Jan 21 '23 17:01

Dima


2 Answers

The definition is in the JSF specification. Here's a cite from the introduction of chapter 3 of the JSF 2.0 specification, the definition is covered in the 1st paragraph:

User Interface Component Model

A JSF user interface component is the basic building block for creating a JSF user interface. A particular component represents a configurable and reusable element in the user interface, which may range in complexity from simple (such as a button or text field) to compound (such as a tree control or table). Components can optionally be associated with corresponding objects in the data model of an application, via value expressions.

JSF also supports user interface components with several additional helper APIs:

  • Converters—Pluggable support class to convert the markup value of a component to and from the corresponding type in the model tier.
  • Events and Listeners—An event broadcast and listener registration model based on the design patterns of the JavaBeans Specification, version 1.0.1.
  • Validators—Pluggable support classes that can examine the local value of a component (as received in an incoming request) and ensure that it conforms to the business rules enforced by each Validator. Error messages for validation failures can be generated and sent back to the user during rendering.

The user interface for a particular page of a JSF-based web application is created by assembling the user interface components for a particular request or response into a view. The view is a tree of classes that implement UIComponent. The components in the tree have parent-child relationships with other components, starting at the root element of the tree, which must be an instance of UIViewRoot. Components in the tree can be anonymous or they can be given a component identifier by the framework user. Components in the tree can be located based on component identifiers, which must be unique within the scope of the nearest ancestor to the component that is a naming container. For complex rendering scenarios, components can also be attached to other components as facets.

Facelets is a view technology which allows you to define the view as mentioned in the last paragraph of the above citation.

like image 94
BalusC Avatar answered Jan 29 '23 17:01

BalusC


Form field, Calendar, Data Table, Tree etc. are the JSF components. Wire them together with Facelets and build component trees. Composition is the name of this game.

like image 22
Costis Aivalis Avatar answered Jan 29 '23 17:01

Costis Aivalis