Introducing Java Server Faces (JSF) - JSF: Terminology Continued
(Page 2 of 4 )
Validator
A Validator does what its name suggests. It validates user input. In other words, it checks whether the input data is in an acceptable form. The main consumer of time in web development is checking the user data through JavaScript or Java or both. Most of the time, the validation routines are like reinventing the wheel. It is here that the power of frameworks come into force.
JSF provides three ways to validate: at the UI component level, via Validator methods in backing beans, or in validator classes. For example, if the zip code field has to be validated, then the logic can be embedded at any of three levels, but when using the logic, the framework abstracts out all the details. When the component is used, the logic is executed at runtime. A single UI Component can have one or more Validators.
Backing Beans
Backing Beans are specialized JavaBeans that collect values from UI Components and implement the event listeners. In other words, Backing Beans control and define the interaction between the UI and the model, and hence are the controllers in JSF. Generally, Backing Beans contain references to the UI Components and the event handlers corresponding to the components. Using the event handlers/listeners, the properties of the UI Components can be processed and the UI can be manipulated as a result of the processing. They can be linked with UI Components declaratively using XML.
Converter
Apart from validations, the other major error-prone area in web development is conversion, that is conversion of one data type to another. In JSF it is the duty of a Converter to convert the values of UI Components to and from String form. A UI Component can only be associated with a single Converter.
Events and Listeners
Any framework based on the event driven paradigm would be failing its intention if event handling is not provided. JSF uses the Swing event/listener model which in turn is based on the JavaBeans event/listener model. UI Components generate events which can be handled by event listeners. The listeners have to be registered so that they can be used to handle events.
Messages
Messages are information that's displayed to the user. Just about any part of the application (backing beans, validators, converters, and so on) can generate information or error messages that can be displayed to the user. A message consists of text that includes a summary or details and a severity level. Localization can be applied to the messages to tailor them to a user's current language. Many times messages can be linked to a particular UI Component.
Navigation
By definition, the act of moving from one page to another is called navigation. JSF provides a powerful navigation system. The Faces Navigation System works in tandem with the Events and Listeners. For a given page, a navigation rule defines what outcomes can be valid, and what pages to load based on those outcomes. Each specific mapping between an outcome and a page is called a navigation case. Faces Navigation heavily relies on Navigation case.
That was a birds' eye view of the key pieces of JSF. In the next section, I will be discussing the steps required to set up a running application based on JSF.
Next: JSF: Steps for Implementation >>
More Java Articles
More By A.P.Rajshekhar