Java Server Faces (JSF
Next Generation User Interface
Masters in Computer
from Mumbai University.
Software developer for 3 years (2007)
Java Web development since 2006
Recent projects use JSF
Working on Code Generation.
Brief History of JSF.
Motivations for JSF, the Java Landscape.
Demo apps in JSF and
How UI Framework originated?
Tradition applications were desktop applications based on
AWT and then Swing.
The origin of internet and increase in the number of clients
gave rise to web based applications.
Traditional web based applications were written in
(still a number of projects are based on
Then came JSP and people said “We have got what we always
no sooner they realized how wrong they were
Some technologies came here and went like light.
a Layered Approach
Why go for a Layered Approach ?
strategic separation of different elements
each layer is organized to provide support and base
functionality to the next
easier to solve multiple small problems than fewer big ones
mitigates risk of technological evolution
value in consistency helps maintenance
A Common Layer Stack
Benefits of a Layered Approach
Change to a different Data Source with minimal effort
through Data Access Layer
Add new Deployment Options
e.g. Add a Web Services
Layer over the Business Services Layer
Storage & Data Structures are independent of the
and so on …
Layer Deployments on Tiers
Layers reside on the same machine, same runtime and any
object visible to one layer can be passed to the other either by
Value or by Reference.
Tiers could be on different machines or on different
runtimes, hence the data has to passed by Value only
In terms of creating a
you have to write huge code to send html text
No separation of concern. Java and HTML mix.
Change in presentation part also required compiling the
And the list goes on….
Issues with JSP
JSP were created
complaints of developers like me
and you who were tired of typing
() + "</TITLE></HEAD>"); into their
To solve the problem of separation of concerns but …
And so on..
Sample JSP Code
Emirates Group IT
Next Generation User Interface
What is Java Server Faces?
JSF is a spec which defines a component
JSF 1.2 is included in the larger JEE5 spec
The spec was developed by involving many people from
orgs like Sun, Apache, IBM, Oracle
Not tied to a Web framework, nor a thick
theoretically could be applied to either
Sun RI vs. Apache
Seam vs. Apache Struts 2 Shale
IBM, Oracle have proprietary solutions
The Problem with Web apps
HTML? HTML? Java people like Objects, HTML is not
Web programming is more difficult than GUI
Java programming is hard
and J2EE is even more
? JSP? EJBs!?!
which turns web
programming into drag
drop, that looks easy! 10
Answer: a Framework!
(yet another framework, of course)
reduced lines of code, made apps pretty complex,
created a niche of skilled Struts mercenaries
fixed some of the Struts hassle
brought powerful AOP concepts to web dev
JSP? dump it, XML rules!
any Web apps in 2006 means seeing a mix of Struts, Tapestry,
Spring MVC, and
(consultant: which one pays the best?)
the battle rages on, who will win? how can you tell who won?
Trust Craig? Trust Rod? How can a OSS project define victory?
Converting legacy apps: Struts is dead! long live Struts 2 Action
and Struts 2 Shale!!!
How can I possibly pick one for a new project, when the
technology is under attack?
JSF to the rescue
Make Committees, Not War!
players together to solve MVC problems in a standard way,
argue, compromise, repeat... publish final Spec
Use components, not actions, more like Swing, less like Struts
Set a standard so we can build derivative products like IDEs with drag
drop ease, without worrying about change
The differentiator that JSF brings, which other similar
frameworks do not have, is the backing of a standard specification
Because JSF is part of the J2EE standard specification, it is a top priority
for every major J2EE tools vendor in the market (including Oracle,
IBM, Borland, and Sun) to support it, which in turn will guarantee a
and good tools support.
and the main objective...
We will hit the target !!!!
3 Tier Application
not again …
How the two brothers are different?
How the JSF Specification Fits In
... What’s a component?
the JSF spec defines a standard set of components and
the View layer (e.g. JSP) and the Java code on the server use
these components to interact and pass data
JSF tree is the current set of components in a Java object
use actions, not components
typical JSF component tree
..some real action
Setup tools like Eclipse 3.5, Maven, 2.x, Tomcat/
Additionally can use