Share on Facebook Share on Twitter Email
Answers.com

JavaServer Faces

 

(JavaServerFaces) A standard framework of components for building rich user interfaces for Java applications. JavaServer Faces run on the server, but are displayed on the client.

Download Computer Desktop Encyclopedia to your iPhone/iTouch

Search unanswered questions...
Enter a question here...
Search: All sources Community Q&A Reference topics
Wikipedia: JavaServer Faces
Top

JavaServer Faces (JSF) is a Java-based Web application framework intended to simplify development integration of user interfaces and the operation on the values they (the UI) hold for Java EE application usage activity e.g. served to client applications of SOA(Service Oriented Architecture). Alike JSP the system has an engine program to it, as Jikes or Jasper of JSP, the engine for JSF is the Faces Servlet but must be specifically referenced in the web application descriptor file(common for all Java Web Applications) called web.xml because it is not directly integrated to the Java Server. Unlike request-driven MVC web frameworks, JSF uses a UI component-cached-object modularised-meta-information-repository approach, where all of the facets are operated upon in one block but to keep the process clean is done in stages called the Faces Lifecycle called phases. While the process can parallel MVC in its facets, when these actions are occurring, is, inside the active lifecycle after the request is received, and not particularly as a direct part of the request or response. Because of this inseparable rigidity unlike MVC, a set of Lifecycle classes and phase event listeners are part of the Java Server Faces programming API to allow the construction and modification of the server side processing block (javax.faces.lifecycle.Lifecycle, javax.faces.lifecycle.LifecycleFactory, javax.faces.event.PhaseEvent) whereby completely modified templates of the phases can be synthesised , substituted and managed. The state of HTML - UI components(and some others) is saved when the client requests a new page(called stateSaving (note: transient true)), and restored (a JSF framework specific programmed controlled action called rendering) at around the time the response is to be returned. Out of the box, JSF uses(euphorically) JavaServer Pages (JSP) for its display technology, but can also accommodate other technologies (such as XUL and Facelets). JSF includes:

  • A set of Java Web APIs for representing user interface (UI) components and managing their state, handling events (an example is javax.faces.event.ActionEvent) and input validation(JSF framework custom programmed validators that are integrated, or, binding to backing-bean method evaluated validators(JSF deferred bean method calls) or a standard JSF library validators), converting values with special JSF converters that are bound to the UI component(much the same service as the validator for the programmatic system), defining page navigation(JSF framework specific hyperlinking, including dynamic navigation with Faces API programmable navigation classes and custom programmed decisions in backing bean methods that can be referenced and controlled with Expression Language(UEL or EL) inside the faces-config.xml configuration file(note: dynamic decisions are made and operative at the instance the activity is occurring not merely at initialisation)) that are configured in the JSF application configuration file called faces-config.xml, and supporting internationalization and accessibility with JSF framework specific .properties message repository files. The properties system is a standard java.util.* system of holding key - value information and alike JSF backing beans or JSP beans, not limited to Java Web Application Frameworks.
  • A default set of UI components, UI Components can be created by the JSF framework specific markup or created entirely programmatically as a Java-JSF object type and stored by a backing-bean/Managed bean (Java bean - re: Java Beans Specifications).
  • A server-side event model : One for associate binding to the rendered view on the client javax.faces.event.ActionEvent . UI Component events ValueChanged events , and Faces Life Cycle events PhaseEvent (The JSF instance positions at which a JSF application process is at, at the time of instance in operation from request-made phase through validation to render/re-render phase) events (Life Cycle sections are generally referred to simply as Life Cycle Phases or Phases).
  • State management (Value of the visual parts kept while not in use are stored either on the server or the client)
  • Managed Beans (JavaBeans created with dependency injection) also called Backing Beans within the Java Beans Specification. These are configured and made available to the application by declaring them in the faces-config.xml configuration file, more than that the term managed really refers to the fact that each java beans property value can be initiated on the first call to the bean by a reference to the beans property in the faces-config.xml inside the section of the backing-bean declaration.
  • Unified Expression Language for both JSP 2.0 and JSF 1.2 with immediate evaluation syntax as JSP is but most used usually in its deferred evaluation syntax.
immediate: ${param.userName} or deferred: #{Userbean.userName} 

The JSF specification was developed under the Java Community Process as JSR 127, which defined JSF 1.0 and 1.1, and JSR 252 which defined JSF 1.2. Upcoming JSF 2.0 is being developed as JSR 314.

Contents

JSF Versions

  • JSF 1.0 (2004-03-11) — the initial release of the JSF specification.
  • JSF 1.1 (2004-05-27) — bug fix release. There were no spec or HTML renderkit changes.
  • JSF 1.2 (2006-05-11) — latest release.
    • provide XML Schema for the config files, instead of using DTD
    • enhancements to allow faces applications to handle multi-frame, or multi-window UI designs
    • enhancements to the f: tag library for improved TCK coverage, f:view lifetime events, and other small features
    • enhancements to the decorator support for API objects
    • security enhancements for client side state saving
    • solve the "duplicate button press" problem (pressing a button twice to cause 2 submissions)
    • re-organize the spec into normative, and non-normative sections, to make implementation easier
    • portlet related bug-fixes
    • bug fixes that require minimal specification changes
  • JSF 2.0 (expected in 2009) - major revision of the specification under development. Planned to coincide with Java EE 6.

JSF and Ajax

JSF is often mentioned together with Ajax, a Rich Internet application technology. Ajax is a combination of technologies that makes it possible to create richer user interfaces. The user interface components in Mojarra (the JSF reference implementation[1]) and MyFaces were originally developed in HTML. Because JSF supports multiple output formats, Ajax-enabled components can easily be added to enrich JSF-based user interfaces. The JSF 2.0 specification intends to improve support for Ajax by allowing UI logic to run partly on the client and not only on the server, and by providing support for graceful degradation when JavaScript is disabled in the browser[citation needed].

Ajax-enabled JSF components and frameworks

The following companies and projects offer Ajax-based JSF implementations or blueprints or component libraries:

Comparison to other Web-GUI Frameworks

Struts

Struts is a popular MVC framework from the Apache Software Foundation. It provides page-at-a-time MVC and does not have a component model in the style of JSF. Pages are mapped to models with a dispatch servlet (controller) piping input to actions. Struts applications use JSPs to render views and are amenable to mix-and-match jsp taglib use. (See also Apache Beehive)

WebObjects / Wotonomy

WebObjects is an early web-application framework that was originally developed by NeXT Software, Inc. then acquired by Apple Computer when it acquired NeXT. It contains an MVC architecture with a component and event model and lifecycle similar to JSF. It is deployable without J2EE (its original configuration), or can be deployed in a servlet container — its dispatcher object acting as the entry-point of a J2EE web application. Unlike JSF's default case, components are not defined in JSP files but are in .wo directories containing any or all of html/xml/wml template files, a .wod file to map fields and actions to Java code, and a .java class. A template file provides the rendering/layout and may include other WebObjects components, rather than the delegated RenderKit approach used by default in JSF. It is a halfway-point between the delegated and directly-rendered approaches used in JSF.

WebObjects also includes a layered architecture with one of the earliest Object-Relational Mapping frameworks, Enterprise Objects Framework.

Wotonomy is a clean-room, open-source re-implementation of the WebObjects frameworks licensed under LGPL. It attempts to implement all parts of WebObjects, and has implemented the whole MVC web-GUI stack. As a clone of WebObjects, it differs from JSF in identical ways, except where it is incomplete.

Apache Tapestry

Tapestry is an open-source framework for creating dynamic, robust, scalable web applications in Java. Tapestry builds upon the standard Java Servlet API, and so it works in any servlet container or application server. Unlike JSF, Tapestry does not use JSP as the default view technology — instead preferring an alternate templating engine that allows for easy HTML preview and editing (similar to the JSF-based Facelets).

Microsoft ASP.NET

The JSF request/response life cycle was initially designed for JSP compatibility, so renders before the object graph has been built on initial page load. This means that JSF cannot handle Get requests. ASP.Net has always built an object model before performing rendering, and thus does not have this and related complications.

JSF features a component based approach to WebApplication development similar to ASP.NET from Microsoft. In ASP.NET v1, component rendering code was bundled with the UI component, unlike JSF, where rendering and component interfaces can be separated, thus allowing for customization of the renderer. ASP.NET v2 introduced the control adapter framework allowing the default rendering to be overridden by third-party code.

Business code is connected to the UI components by subscribing to events generated by the components and stored in a separate file ("code behind"). Thus a typical ASP.NET page consists of a (HTML) file describing the visual page layout (design), and a file with the page logic (code). Both files are treated as one single entity by Visual Studio.

According to the author of the book Core JSF, JSF offers a means for Java to compete with ASP.Net/Visual Studio in the area of Rapid application development (RAD).

Latest Developments

In the latest still unreleased public draft for JEE6, Facelets (which was designed specifically for Java Server Faces) will be adopted as the official view technology for JSF 2.0. This will eliminate the well-known life-cycle conflicts that existed with JSP forcing workarounds by Java developers. Facelets will also allow easier tag creation using markup instead of Java code, the chief complaint against JSF.

The new JSF developments will also see the usage of Java EE5 style annotations such as @ManagedBean and @ManagedProperty which will lead to a reduction in the size of the faces-config.xml config file. However, navigation still needs to be done in the configuration file.

There will also be changes to the JSF lifecycle to account for AJAX which will make AJAX development using JSF feel more natural.

The latest JSF release will also have built-in capability to handle resources like images, CSS and Javascript and refer to them using logical names and also grouping resources into libraries and versioning.

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.

Popular Extensions and Libraries

See also

References

Books

External links


 
 
Learn More
JSF
Facelets
Faces

Why not you on face? Read answer...
Who has a face? Read answer...
What is you face? Read answer...

Help us answer these
Why does he do that face?
Do you have do do on your face?
In your face?

Post a question - any question - to the WikiAnswers community:

 

Copyrights:

Computer Desktop Encyclopedia. THIS COPYRIGHTED DEFINITION IS FOR PERSONAL USE ONLY.
All other reproduction is strictly prohibited without permission from the publisher.
© 1981-2009 Computer Language Company Inc.  All rights reserved.  Read more
Wikipedia. This article is licensed under the Creative Commons Attribution/Share-Alike License. It uses material from the Wikipedia article "JavaServer Faces" Read more