Q: How to print
out html markup with h:outputText?
A: The h:outputText has attribute escape that
allows to escape the html markup. By default,
it equals to "true". It means all
the special symbols will be replaced with '&'
codes. If you set it to "false", the
text will be printed out without ecsaping.
For example, <h:outputText value="<b>This
is a text</b>"/>
will be printed out like:
<b>This is a text</b>
In case of <h:outputText escape="false"
value="<b>This is a text</b>"/>
you will get:
This is a text
Q: h:inputSecret
field becomes empty when page is reloaded. How
to fix this?
A: Set redisplay=true, it is false by default.
Q: Who
are the users of JSF technology?
JSF is that it has not only been designed for
coding experts but for others also Page authors,
Component writers etc. Because of integrating
MVC model and flexible in its architecture JSF
allows a wide range of users :
1. Page authors :
Web designers have experience with graphic design.
They can design look and feel of web application
in html/jsp using custom tag libraries of JSF.
2. Application developers :
Application developers can integrate this design
with UI components. They program objects, event
handling, converters, validators.
3. Component writers :
Component developer can build custom UI components
because of JSF’s extensible and customizable
nature. They can create their own components
directly from UI component classes or extending
the standard components of JSF.
4. Application architects :
Application architects are responsible for designing
web applications. Defining page navigation,
ensuring Scalability of application, configuring
beans object registration are the key points
that an application architect handles.
5. Tool vendors :
JSF is well suited for tool vendors, for example
Sun Java Studio Creator application development
tool, who provide tools that take advantages
of JSF to create UI easier.
Q: What are JSF releases?
JSF started its journey from version 1.0 and
now it has come to its latest version JSF1.2.
The listing of versions released so far is :
a. JSF 1.2 (11 may 2006) - Latest release of
JSF specification.
b. JSF 1.1 (27 may 2004) - Bug fix release.
No specification changes. No HTML renderkit
changes.
c. JSF 1.0 (11 mar 2004) - Initial release of
JSF specification.
There are many releases of 1.1 and 1.2 and these
are listed below showing released date also:
d. 1.2_04 P01 (20 Mar 2007)
e. 1.2_04 (5 Mar 2007)
f. 1.2_02 (25 Aug 2006)
g. 1.2_01 (14 July 2006)
h. 1.1_02 (24 Apr 2006)
i. 1.1_01 (07 Sep 2004)
Q: How JSF Fits For Web Applications?
JSF has many advantages over other existing
frameworks that makes it a better choice for
Java web application development. Some of the
reasons are below:
a. Easy creation of UI:
It makes easier to create complex UI for an
applicaton using jsf tags.Its APIs are layered
directly on top of servlet APIs that enables
us to use presentation technology other than
JSP,creating your own custom components and
rendering output for various client devices.
b. Capacity to handle complexities of UI management:
It handles cleanly the complexities of UI management
like input validation, component-state management,
page navigation, and event handling.
c. Clean separation between presentation and
logic:
One of the greatest advantage of jsf is to clearly
separate behaviour and presentation in an application.
JSF is based on the Model View Controller (MVC)
architecture
d. Shorter development cycle:
This separation between logic and presentation
enables a wide range of users( from web-page
designers to component developers). It allows
members of team to focus on their own work only
, resulting in division of labour and shorter
development cycle.
e. Standard Java framework:
JSF is a Java standard which is being developed
through Java Community Process (JCP). Several
prominent tool vendors are members of the group
and are committed to provide easy to use, visual,
and productive develop environments for JavaServer
Faces.
f. An extensible architecture:
JSF architecture has been designed to be extensible.Extensible
means additional functionality can be given
on the top of JSF core i.e. we can customize
the functionality. JSF UI components are customizable
and reusable elements. You can extend standard
components and create your own complex components
like stylish calendar, menu bar etc.
g. Support for multiple client devices:
Component developers can extend the component
classes to generate their own component tag
libraries to support specific client. JSF flexible
and extensible architecture allows developers
to do so.
h. Flexible rendering model:
Renderer separates the functionality and view
of the component. So we can create multiple
renderers and give them different functionality
to get different appearance of the same component
for the same client or different .
i. International language support:
Java has excellent support for internationalization
. It allows you to localize messages with user
specific locale. A locale is a combination of
a country, a language, and a variant code. Java
Server Faces adopts this property and let you
specify which locale your application supports.
So you can display you messages in different
languages.
j. Robust tool support:
There are several standard tool vendors like
Sun Java Studio Creator who provide robust tools
that take advantages of JSF to create server
side UI easily.
Q: What does component mean and what
are its types?
A: Components in JSF are elements like text
box, button, table etc. that are used to create
user interfaces of JSF Applications. These are
objects that manage interaction with a user.
Components help developers to create UIs by
assembling a number of components , associating
them with object properties and event handlers.
Would u like to repeat the same code again &
again and waste time if u want to create many
tables in hundreds of pages in your web application?
Not at all. Once you create a component, it’s
simple to drop that component onto any JSP.
Components in JSF are of two types :
a. Simple Components like text box, button and
b. Compound Components like table, data grid
etc.
A component containing many components inside
it is called a compound component.
JSF allows you to create and use components
of two types:
1. Standard UI Components:
JSF contains its basic set of UI components
like text box, check box, list boxe, button,
label, radio button, table, panel etc. These
are called standard components.
2. Custom UI Components:
Generally UI designers need some different ,
stylish components like fancy calendar, tabbed
panes . These types of components are not standard
JSF components. JSF provides this additional
facility to let you create and use your own
set of reusable components. These components
are called custom components.
1. What are third party components and how they
are useful?
One of the greatest power of JSF is to support
third party components . Third party components
are custom components created by another vendor.
Several components are available in the market,
some of them are commercial and some are open
source . These pre-built & enhanced components
can be used in UI of your web application. For
example, we are in need of a stylish calendar
then we have an option to take it from third
party rather than creating it our own. This
will help saving time & cost creating effective
& robust UI and to concentrate on business
logic part of web application.
2. What are tags in JSF ?
JSF application typically uses JSP pages to
represent views. JSF provides useful special
tags to enhance these views. Each tag gives
rise to an associated component. JSF (Sun Implementation)
provides 43 tags in two standard JSF tag libraries:
1. JSF Core Tags Library
2. JSF Html Tags Library
Even a very simple page uses tags from both
libraries. These tags can be used adding the
following lines of code at the head of the page.
<%@ taglib uri=”http://java.sun.com/jsf/core
“ prefix=”f” %> (For Core
Tags)
<%@ taglib uri=”http://java.sun.com/jsf/html
“ prefix=”h” %> (For Html
Tags)