0% found this document useful (0 votes)
9 views

JSF

Uploaded by

yashoda sailwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

JSF

Uploaded by

yashoda sailwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 22

JSF

JAVASERVER
FACES
J AVA S E R V E R FA C E S

It is a server side component based


user interface framework. It is used to
develop web applications. It provides a
well-defined programming model and
consists of rich API and tag libraries.

The latest version JSF 2 uses


Facelets as its default templating
system. It is written in Java.
J S F C O N T. . .

The JSF API provides components (inputText,


commandButton etc) and helps to manage
their states. It also provides server-side
validation, data conversion, defining page
navigation, provides extensibility, supports
for internationalization, accessibility etc.
The JSF Tag libraries are used to add
components on the web pages and
connect components with objects on
the server. It also contains tag
handlers that implements the
component tag.
W H AT I S J S F

JavaServer Faces (JSF) is a UI component


based Java Web application framework. JSF is
serverbased, e.g. the JSF UI components and
their state are represented on the server
with a defined life cycle of the UI
components.

JSF is part of the Java EE standard.


J S F M A I N F E AT U R E S

Component Based Framework


Implements Facelets Technology
Integration with Expression Language
Support HTML5
Ease and Rapid web Development.
Support Internationalization
Bean Annotations
Default Exception Handling
Templating
Inbuilt AJAX Support
Security
J S F M A I N F E AT U R E S

Component Based Framework

JSF is a server side component-based framework. It provides inbuilt components


to build web application. You can use HTML5, Facelets tags to create web pages.

Facelets Technology

Facelets is an open source Web template system. It is a default view handler


technology for JavaServer Faces (JSF). The language requires valid input XML
documents to work. Facelets supports all of the JSF UI components and focuses
completely on building the view for a JSF application.
J S F M A I N F E AT U R E S

Expression Language

Expression Language provides an important mechanism for creating the user interface (web pages) to
communicate with the application logic (managed beans). The EL represents a union of the expression
languages offered by JavaServer Faces technology.
HTML 5

HTML5 is the new standard for writing web pages. JavaServer Faces version 2.2 offers an easy way for
including new attributes of HTML 5 to JSF components and provides HTML5 friendly markup.

Ease and Rapid web Development.

JSF provides rich set of inbuilt tools and libraries so that you can easily and rapidly develop we application.
J S F M A I N F E AT U R E S

Support Internationalization

JSF supports internationalization for creating World Class web application. You can create
applications in the different-different languages. With the help of JSF you can make the application
adaptable to various languages and regions.

Bean Annotations

JSF provides annotations facility in which you can perform validation related tasks in Managed Bean.
It is good because you can validate your data in bean rather than in HTML validation.

Exception Handling

JSF provide default Exception handling so you can develop exception and bug free web application.
J S F M A I N F E AT U R E S
• Templating
• Introducing template in new version of JSF provides reusablity of components. In JSF application,
you can create new template, reuse template and treat it as component for application.
• AJAX Support
• JSF provides inbuilt AJAX support. So, you can render application request to server side without
refreshing the web page. JSF also support partial rendering by using AJAX.
• Security
• JSF provides implicit protection against this when state is saved on the server and no stateless
views are used, since a post-back must then contain a valid javax.faces.ViewState hidden
parameter. Contrary to earlier versions, this value seems sufficiently random in modern JSF
implementations. Note that stateless views and saving state on the client does not have this
implicit protection.
J AVA S E R V E R
FA C E S
LIFECYCLE
L I F E C Y C L E S TA G E
JavaServer Faces application framework manages
lifecycle phases automatically for simple
applications and also allows you to manage that
manually. The lifecycle of a JavaServer Faces
application begins when the client makes an HTTP
request for a page
The JSF lifecycle and ends
is divided when
into twothe server
main phases:
responds with the page.

JSF IFE Execute Phase


CYCLE

Render Phase
• JSF begins the restore view phase as soon as a link or a button is clicked and JSF
receives a request.

• During this phase, the JSF builds the view, wires event handlers and validators to UI
components and saves the view in the FacesContext instance.

• The FacesContext instance will now contains all the information required to process
a request

PHASE 1:
RESTORE VIEW
PHASE 2: A P P LY REQUEST VALUES

In this phase, the values that are entered by the user will be
updated on each and every individual component defined in
the View graph.

Component stores this value.

If any of the Conversions or the Validations fail, then the


current processing is terminated and the control directly
goes to the Render Response for rendering the conversion
or the validation errors to the Client.
PHASE 3: PROCESS VALIDATION

These validations
This Phase will will only happen
process any for the UI
Validations that Components only
are configured if the property
for UI 'rendered'
Components. property is set to
'true'.
PHASE 4: UPDATE MODEL VALUES

After the JSF checks that the data is


valid, it walks over the component
tree and set the corresponding
server-side object properties to the
component’s local values.

The JSF will update the bean


properties corresponding to
input component's value
attribute
During this phase, the JSF handles
any application-level events, such
as submitting a form / linking to
another page.

PHASE 5:
INVOKE
A P P L I C AT I O N In this phase, JSF Implementation
will call the
UIComponentBase.processApplica
tions() method which will
immediately call the Render
Response Phase.
PHASE 6: RENDER RESPONSE

And finally, we have


reached the Render
Response whose job is
to render the response
back the Client
Application.
RENDER
RESPONSE PHASE
• This is last phase of JSF life cycle. In
this phase, JSF builds the view and
delegates authority to the appropriate
resource for rendering the pages.
2) RENDER
• In this phase, the requested view is
rendered as a response to the client
browser. View rendering is a process
in which output is generated as
HTML or XHTML. So, user can see it
at the browser.
THE Application is compiled, when a client makes an initial
request for the index.xhtml web page.
FOLLOWING Application executes after compilation and a new
STEPS ARE component tree is constructed for the application and
placed in a FacesContext.
TA K E N The component tree is populated with the component
and the managed bean property associated with it,
DURING represented by the EL expression.
THE Based on the component tree. A new view is built.
RENDER
PROCESS. The view is rendered to the requesting client as a
response.

The component tree is destroyed automatically.

On subsequent requests, the component tree is rebuilt,


and the saved state is applied.
F I R S T J S F A P P L I C AT I O N I N
ECLIPSE

DOWNLOAD https://jstl.java.net/downloa
d.html
.

You might also like