Q: What are
the advantages of JSF?
The major benefits of JavaServer Faces technology
are:
• JavaServer Faces architecture makes
it easy for the developers to use. In JavaServer
Faces technology, user interfaces can be created
easily with its built-in UI component library,
which handles most of the complexities of user
interface management.
• Offers a clean separation between behavior
and presentation.
• Provides a rich architecture for managing
component state, processing component data,
validating user input, and handling events.
• Robust event handling mechanism.
• Events easily tied to server-side code.
• Render kit support for different clients
• Component-level control over statefulness
• Highly 'pluggable' - components, view
handler, etc
• JSF also supports internationalization
and accessibility
• Offers multiple, standardized vendor
implementations
Q: What are differences between struts
and JSF?
In a nutshell, Faces has the following advantages
over Struts:
• Eliminated the need for a Form Bean
• Eliminated the need for a DTO Class
• Allows the use of the same POJO on all
Tiers because of the Backing Bean
The primary advantages of Struts as compared
to JavaServer Faces technology are as follows:
• Because Struts is a web application
framework, it has a more sophisticated controller
architecture than does JavaServer Faces technology.
It is more sophisticated partly because the
application developer can access the controller
by creating an Action object that can integrate
with the controller, whereas JavaServer Faces
technology does not allow access to the controller.
In addition, the Struts controller can do things
like access control on each Action based on
user roles. This functionality is not provided
by JavaServer Faces technology.
• Struts includes a powerful layout management
framework, called Tiles, which allows you to
create templates that you can reuse across multiple
pages, thus enabling you to establish an overall
look-and-feel for an application.
• The Struts validation framework includes
a larger set of standard validators, which automatically
generate both server-side and client-side validation
code based on a set of rules in a configuration
file. You can also create custom validators
and easily include them in your application
by adding definitions of them in your configuration
file.
The greatest advantage that JavaServer Faces
technology has over Struts is its flexible,
extensible UI component model, which includes:
• A standard component API for specifying
the state and behavior of a wide range of components,
including simple components, such as input fields,
and more complex components, such as scrollable
data tables. Developers can also create their
own components based on these APIs, and many
third parties have already done so and have
made their component libraries publicly available.
• A separate rendering model that defines
how to render the components in various ways.
For example, a component used for selecting
an item from a list can be rendered as a menu
or a set of radio buttons.
• An event and listener model that defines
how to handle events generated by activating
a component, such as what to do when a user
clicks a button.
• Conversion and validation models for
converting and validating component data.
Q: What are the available implementations
of JavaServer Faces?
The main implementations of JavaServer Faces
are:
• Reference Implementation (RI) by Sun
Microsystems.
• Apache MyFaces is an open source JavaServer
Faces (JSF) implementation or run-time.
• ADF Faces is Oracle’s implementation
for the JSF standard.
Q: What typical JSF application consists
of?
A typical JSF application consists of the following
parts:
• JavaBeans components for managing application
state and behavior.
• Event-driven development (via listeners
as in traditional GUI development).
• Pages that represent MVC-style views;
pages reference view roots via the JSF component
tree.
Q: What Is a JavaServer Faces Application?
JavaServer Faces applications are just like
any other Java web application. They run in
a servlet container, and they typically contain
the following:
• JavaBeans components containing application-specific
functionality and data.
• Event listeners.
• Pages, such as JSP pages.
• Server-side helper classes, such as
database access beans.
In addition to these items, a JavaServer Faces
application also has:
• A custom tag library for rendering UI
components on a page.
• A custom tag library for representing
event handlers, validators, and other actions.
• UI components represented as stateful
objects on the server.
• Backing beans, which define properties
and functions for UI components.
• Validators, converters, event listeners,
and event handlers.
• An application configuration resource
file for configuring application resources.