JSF Interview Questions Posted on: February 27, 2008 at 12:00 AM
What is JSF life cycle and its phases?
The series of steps followed by an application is called its life cycle. A JSF application typically follows six steps in its life.
JSF Interview Questions
What is JSF life cycle and its phases? The series of steps followed by an application
is called its life cycle. A JSF application typically follows six steps
in its life.
Restore view phase
request values phase
Update model values
Invoke application phase
What is the role of Renderer in JSF? and justify the
statement "JSF supports multiple client devices". After creating JSF components, it is also necessaryfor
each component to be rendered to the client so that it can be visible to
the client?s device. Each of the tag gives rise to an associated
component. A renderer is a type of class that is responsible for
encoding and decoding components. Encoding displays the component while
decoding translates the user?s input into components value i.e.
transform it into values the component can understand.
Now a days there are many devices that are web enabled. So application
developers have challenge to develop components that can work across
various platforms. For example, if we have an application that works on
standard web browser and we want to extend it to make it enable to work
on a WAP device. So, to handle this case we need components to be
rendered in more than one way. Here JSF can be helpful. This is a simple
task for JSF. The solution is to develop separate renderers for the
component. JSF components use different renderers depending on the
What is Render Kit in JSF? Component classes generally transfer the task of generating output
to the renderer. All JSF components follow it. Render kit is a set of
related renderers. javax.faces.render.RenderKit is the class
which represents the render kit. The default render kit contains
renderers for html but it?s up to you to make it for other markup
languages. Render kit can implement a skin (a look & feel). Render
kit can target a specific device like phone, PC or markup language like
HTML, WML, SVG. This is one of the best benefit of JSF because JSF
doesn't limit to any device or markup.
What is conversion and validation? and how are they related? This is one of the phase of JSF life cycle
that happens before binding the component data to the related backing
bean in the Update model values phase.
Conversion is the process of transforming the component data from
String to Java objects and vice versa. For example, an user enters a value (String) in an input component and
this value is to store in a Date field in the backing bean then this
String value is converted to a java.util.Date value when request is sent
to the server and vice versa. This process is
Validation is the process of ensuring data contains the expected content.
For example, checking the Date value is in MM./dd/YYYY format or any
integer value is between 1 to 10.
The main purpose of conversion and validation is to ensure the values
are of correct type and following the required criteria before updating model data.
So this step allows you to focus on business logic rather than working
on tedious qualifications of input data such as null checks, length qualifiers, range boundaries, etc.
When automatic conversion is supplied by JSF Implementation?
JSF implementation automatically converts component data between
presentation view and model when the bean property associated with the component is of one of the
types supported by the component's data.
For example, If a UISelectBoolean component is associated with a bean property of type
Boolean, then JSF implementation will automatically convert the data from String to Boolean.