JavaServer Faces
Encyclopedia
JavaServer Faces is a Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

-based Web application framework
Web application framework
A web application framework is a software framework that is designed to support the development of dynamic websites, web applications and web services. The framework aims to alleviate the overhead associated with common activities performed in Web development...

 intended to simplify development integration of web-based user interface
User interface
The user interface, in the industrial design field of human–machine interaction, is the space where interaction between humans and machines occurs. The goal of interaction between a human and a machine at the user interface is effective operation and control of the machine, and feedback from the...

s.

JSF is a request-driven MVC
Model-view-controller
Model–view–controller is a software architecture, currently considered an architectural pattern used in software engineering. The pattern isolates "domain logic" from the user interface , permitting independent development, testing and maintenance of each .Model View Controller...

 web framework based on component-driven UI design model, using XML files called view templates or Facelets
Facelets
In computing, Facelets is an open source Web template system under the Apache license and the default view handler technology for JavaServer Faces . The language requires valid input XML documents to work...

 views. Requests are processed by the FacesServlet, which loads the appropriate view template, builds a component tree, processes events, and renders the response (typically HTML) to the client. The state of UI components (and some other objects) is saved at the end of each request (called stateSaving (note: transient true)), and restored upon next creation of that view. Several types of state-saving are available, including Client-side and Server-side state saving. Out of the box, JSF 1.x uses JavaServer Pages
JavaServer Pages
JavaServer Pages is a Java technology that helps software developers serve dynamically generated web pages based on HTML, XML, or other document types...

 (JSP) for its display technology, but can also accommodate other technologies (such as XUL
XUL
In computer programming, XUL , the XML User Interface Language, is an XML user interface markup language developed by the Mozilla project. XUL operates in Mozilla cross-platform applications such as Firefox...

 and Facelets
Facelets
In computing, Facelets is an open source Web template system under the Apache license and the default view handler technology for JavaServer Faces . The language requires valid input XML documents to work...

). JSF 2 uses Facelets by default for this purpose. Facelets is a more efficient, simple, and yet more powerful view description language (VDL).

Core features

  • Managed Beans: A dependency injection
    Dependency injection
    Dependency injection is a design pattern in object-oriented computer programming whose purpose is to improve testability of, and simplify deployment of components in very large software systems....

     system (easily interfaced with CDI, Spring, or Guice
    Google Guice
    Google Guice is an open source software framework for the Java platform released by Google under an Apache license. It provides support for dependency injection using annotations to configure Java objects...

    ) - also called "Backing Beans" or "Page Beans"
  • A template-based component system, for rapid composite component creation - without the need for Java classes.
  • Built in Ajax
    Ajax (programming)
    Ajax is a group of interrelated web development methods used on the client-side to create asynchronous web applications...

     support using (since JSF v2.0).
  • Built in support for bookmarking & page-load actions.
  • Integration with the Unified Expression Language
    Unified Expression Language
    The Java Unified Expression Language is a special purpose programming language mostly used in Java web applications for embedding expressions into web pages....

     (EL), which is core to the function of JSF. Views may access managed bean fields and methods via EL: <my:component rendered="#{myBean.userLoggedIn}" />
  • A default set of HTML and web-application specific UI components
  • A server-side
    Server-side
    Server-side refers to operations that are performed by the server in a client–server relationship in computer networking.Typically, a server is a software program, such as a web server, that runs on a remote server, reachable from a user's local computer or workstation...

     event model : For dispatching events and attaching listeners to core system functionality, such as "Before Render Response" or "After Validation"
  • State management, supporting: "request", "session", "application", "flash", and "view" scoped Java beans.
  • Two XML-based tag libraries (core and html) for expressing a JavaServer Faces interface within a view template (can be used with both JSP
    JavaServer Pages
    JavaServer Pages is a Java technology that helps software developers serve dynamically generated web pages based on HTML, XML, or other document types...

     or Facelets)

JSF versions

  • JSF 2.1 (2010-10-22) — Current version. Second maintenance release of 2.0. Only very minor amount of spec changes.
  • JSF 2.0 (2009-06-28) — Major release for ease of use, enhanced functionality, and performance. Coincides with Java EE
    Java Platform, Enterprise Edition
    Java Platform, Enterprise Edition or Java EE is widely used platform for server programming in the Java programming language. The Java platform differs from the Java Standard Edition Platform in that it adds libraries which provide functionality to deploy fault-tolerant, distributed, multi-tier...

     6.
  • JSF 1.2 (2006-05-11) — Many improvements to core systems and APIs. Coincides with Java EE
    Java Platform, Enterprise Edition
    Java Platform, Enterprise Edition or Java EE is widely used platform for server programming in the Java programming language. The Java platform differs from the Java Standard Edition Platform in that it adds libraries which provide functionality to deploy fault-tolerant, distributed, multi-tier...

     5. Initial adoption into Java EE.
  • JSF 1.1 (2004-05-27) — (DEPRECATED) bug fix release. There were no spec or HTML renderkit changes.
  • JSF 1.0 (2004-03-11) — (DEPRECATED) the initial release of the JSF specification. Separate release that wasn't part of any Java EE/J2EE release.

JSF and Ajax

JSF is often used together with Ajax
Ajax (programming)
Ajax is a group of interrelated web development methods used on the client-side to create asynchronous web applications...

, a Rich Internet application
Rich Internet application
A Rich Internet Application is a Web application that has many of the characteristics of desktop application software, typically delivered either by way of a site-specific browser, via a browser plug-in, independent sandboxes, extensive use of JavaScript, or virtual machines...

 technology. Ajax is a combination of technologies that make it possible to create rich user interfaces. The user interface components in Mojarra (the JSF reference implementation) and MyFaces were originally developed for HTML only, and Ajax had to be added via JavaScript. This has changed, however:

Because JSF supports multiple output formats, Ajax-enabled components can easily be added to enrich JSF-based user interfaces. The JSF 2.0 specification provides built in support for Ajax by standardizing the Ajax request lifecycle, and providing simple development interfaces to Ajax events, allowing any event triggered by the client to go through proper validation, conversion, and finally method invocation, before returning the result to the browser via an XML DOM update.

JSF 2 includes support for graceful degradation when JavaScript
JavaScript
JavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles....

 is disabled in the browser.

Ajax-enabled components and frameworks

The following companies and projects offer Ajax-based JSF frameworks or component libraries:
  • jBoss
    JBoss
    JBoss Application Server is an open-source Java EE-based application server. An important distinction for this class of software is that it not only implements a server that runs on Java, but it actually implements the Java EE part of Java...

     RichFaces
    Richfaces
    RichFaces is an open source Ajax-enabled component library for JavaServer Faces, hosted by JBoss. It allows easy integration of Ajax capabilities into enterprise application development.RichFaces is more than just a component library for JavaServer Faces...

    (derived from and replaces Ajax4jsf
    Ajax4jsf
    Ajax4jsf was a project for an open source framework that added Ajax capabilities to the JavaServer Faces web application framework.It was an early entrant to the JSF space, but did implement a still-rare feature, that of skinning....

    ), Ajax-enabled JSF components for layout, file upload, forms, inputs and many other features.
  • ICEfaces
    ICEfaces
    ICEfaces is an open source Ajax framework that enables Java EE application developers to create and deploy server-based rich Internet application using the Java language....

    , open-source, Java JSF extension framework and rich components, Ajax without JavaScript
  • Oracle
    Oracle Corporation
    Oracle Corporation is an American multinational computer technology corporation that specializes in developing and marketing hardware systems and enterprise software products – particularly database management systems...

     ADF Faces Rich Client, Oracle Application Development Framework
    Oracle Application Development Framework
    In computing, Oracle Application Development Framework, usually called Oracle ADF, provides a commercial Java framework for building enterprise applications. It provides visual and declarative approaches to Java EE development...

  • Backbase
    Backbase
    Backbase is a software company, founded in the Netherlands in 2003, which has offices in Amsterdam, the Netherlands and New York, United States. The core products of Backbase are Backbase Portal and Backbase Forms. In October 2011, industry analyst Gartner placed Backbase Portal in the Visionary...

     Enterprise Ajax — JSF Edition, Ajax framework
    Ajax framework
    In web application development, an Ajax framework is a framework which leverages Ajax, a collection of technologies for building dynamic web pages on the client side...

  • IBM Lotus Notes - XPages
    XPages
    XPages is a rapid web and mobile application development platform. It allows IBM Lotus Notes data to be displayed to browser clients on all platforms....

  • MyFaces, The Apache Foundation JSF implementation with Ajax components
  • Sun
    Sun Microsystems
    Sun Microsystems, Inc. was a company that sold :computers, computer components, :computer software, and :information technology services. Sun was founded on February 24, 1982...

     Java BluePrints AJAX Components
  • ZK Ajax framework with JSF components

Latest developments

Facelets
Facelets
In computing, Facelets is an open source Web template system under the Apache license and the default view handler technology for JavaServer Faces . The language requires valid input XML documents to work...

 (which was designed specifically for JavaServer Faces) was adopted as the official view technology for JSF 2.0. This eliminates the life-cycle conflicts that existed with JSP, forcing workarounds by Java developers. Facelets allows easy component/tag creation using XML markup instead of Java code, the chief complaint against JSF 1.x.

The new JSF developments also provide wide accessibility to Java 5 annotations such as @ManagedBean, @ManagedProperty and @FacesComponent which removes the need for faces-config.xml in all cases save framework extension. Navigation has been simplified, removing the need for faces-config.xml navigation cases. Page transitions can be invoked simply by passing the name of the desired View/Facelet.

Addition of Partial State Saving and DOM updates are part of the built in standardized Ajax
Ajax (programming)
Ajax is a group of interrelated web development methods used on the client-side to create asynchronous web applications...

 support.

The latest JSF release has built-in support for handling resources like images, CSS and Javascript, allowing artifacts to be included with component libraries, separated into JAR files, or simply co-located into a consistent place within the web-application. Includes logical naming and versioning of resources.

JSF 2.0 also includes a number of other changes like adding support for events, RAILS_ENV style development stages and significantly expanding the standard set of components.

Further reading

  • Jonas Jacobi, John R. Fallows: Pro JSF APIs and Ajax, Apress, ISBN 1-59059-580-7
  • Chris Schalk, Ed Burns, James Holmes: JavaServer Faces: The Complete Reference, McGraw-Hill Osborne Media, ISBN 0-07-226240-0
  • David Geary, Cay Horstmann: Core JavaServer Faces, Second Edition, Prentice-Hall, 2007 ISBN 0-13-173886-0
  • Kito D. Mann: JavaServer Faces in Action, Manning Publications Company, ISBN 1-932394-12-5
  • Bill Dudney, Jonathan Lehr, Bill Willis
    Bill Willis
    William Karnet Willis was one of the dominant American football players of the 1940s and 1950s, and is an inductee in the College and Professional Football Halls of Fame. Willis was one of the first African American football players to play professional football...

    , LeRoy Mattingly: Mastering JavaServer Faces, John Wiley & Sons, ISBN 0-471-46207-1
  • Hans Bergsten: JavaServer Faces, O'Reilly & Associates, ISBN 0-596-00539-3
  • Budi Kurniawan, Nancy Maragioglio: JavaServer Faces Programming, McGraw-Hill Osborne Media, ISBN 0-07-222983-7
  • James Turner, Craig McClanahan
    Craig McClanahan
    Craig R. McClanahan is a programmer and original author of the Apache Struts framework for building web applications. He was part of the expert group that defined the servlet 2.2, 2.3 and JSP 1.1, 1.2 specifications. He is also the architect of Tomcat's servlet container Catalina.-External links:*...

    , Kunal Mittal: JavaServer Faces Kick Start, SAMS, ISBN 0-672-32599-3
  • John Ferguson Smart: JSF Jumpstart - A tutorial introduction to building web sites using JSF, published in electronic form.

External links

The project page for JSF at java.net
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK