What is JSF (or JavaServer
Faces)?
A server side user interface component
framework for Java™ technology-based web applications.JavaServer Faces (JSF) is
an industry standard and a framework for building component-based user
interfaces for web applications.
JSF contains an API for representing UI components and managing their state;
handling events, server-side validation, and data conversion; defining page
navigation; supporting internationalization and accessibility; and providing
extensibility for all these features.
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
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
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.
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.
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.
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.
What is Backing Bean?
Backing beans are JavaBeans components
associated with UI components used in a page. Backing-bean management separates
the definition of UI component objects from objects that perform
application-specific processing and hold data.
The backing bean defines properties and handling-logics associated with the UI
components used on the page. Each backing-bean property is bound to either a
component instance or its value. A backing bean also defines a set of methods
that perform functions for the component, such as validating the component's
data, handling events that the component fires and performing processing
associated with navigation when the component activates.
What are the differences between a
Backing Bean and Managed Bean?
Backing Beans are merely a convention, a
subtype of JSF Managed Beans which have a very particular purpose. There is
nothing special in a Backing Bean that makes it different from any other
managed bean apart from its usage.
What makes a Backing Bean is the
relationship it has with a JSF page; it acts as a place to put component
references and Event code.
What
is view object?
A view object is a model object used
specifically in the presentation tier. It contains the data that must display
in the view layer and the logic to validate user input, handle events, and
interact with the business-logic tier. The backing bean is the view object in a
JSF-based application. Backing bean and view object are interchangeable terms.
What do you mean by Bean Scope?
Bean Scope typically holds beans and other
objects that need to be available in the different components of a web
application.
What are the different kinds of
Bean Scopes in JSF?
JSF supports three Bean Scopes. viz.,
Request Scope: The request scope is short-lived. It starts when
an HTTP request is submitted and ends when the response is sent back to the
client.
Session Scope: The session scope persists from the time that a
session is established until session termination.
Application Scope: The application scope persists for the entire
duration of the web application. This scope is shared among all the requests
and sessions.
Posted in: