SunQuest
 
       Java
  Home arrow Java arrow Introducing JavaServer Faces
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVA

Introducing JavaServer Faces
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 4
    2005-10-06

    Table of Contents:
  • Introducing JavaServer Faces
  • How Does JSF Compare to Traditional Technologies?
  • More Modular User Interface Code
  • Where Does JSF Fit in the Big Picture?
  • What You Need to Get Started

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Introducing JavaServer Faces


    (Page 1 of 5 )

    JavaServer Faces (JSF) simplifies the development of web application user interfaces, allowing Java programmers to develop the application backend without worrying about a lot of details. This article offers a brief introduction to the technology. It is excerpted from chapter one of the book JavaServer Faces, written by Hans Bergsten (O'Reilly, 2004; ISBN: 0596005393).

    Over the last few years, Java has established itself as the leading technology for web application development. Developers are using technologies like servlets and JSP to develop scalable and robust browser-based user interfaces for countless applications with great success. But as web applications become more complex, some developers are longing for the good ol' days of traditional graphical user interface (GUI) frameworks with rich, powerful user interface widgets and event-driven development models. Servlets and JSP have served us well, but HTTPs stateless nature and simple, coarse-grained request/response model forces application developers using these technologies to struggle with details that are handled behind the scenes by GUI frameworks like AWT/Swing, the standard GUI framework for Java.

    To make it easier to develop sophisticated web application user interfaces, open source projects and commercial companies have developed frameworks that mimic traditional GUI frameworks as far as possible. Some notable examples are Enhydra's Barracuda, Apache's Tapestry, Oracle's UIX, and Sun's JATO. In the spring of 2001, a Java Community Process (JCP) group was formed with representatives from most of these efforts (including yours truly) to come up with a standard solution that all frameworks can use. The result is JavaServer Faces; the 1.0 version of the specification was released in March 2004.

    What Is JavaServer Faces?

    JavaServer Faces (JSF) simplifies development of sophisticated web application user interfaces, primarily by defining a user interface component model tied to a well-defined request processing lifecycle. This allows:

    • Java programmers to develop the application backend without worrying about HTTP details and integrate it with the user interface through a familiar event-driven model with type-safe interfaces.
    • Page Authors without programming knowledge to work with the user interface "look and feel" aspects by assembling components that encapsulate all user interaction logic-- thereby minimizing the need for program logic embedded directly in the user interface pages.

    • Vendors to develop powerful tools for both frontend and backend development.

    More specifically, JSF is a specification with implementations offered by multiple vendors. It defines a set of user interface (UI) components--basically, a one-to-one mapping to the HTML form element set plus a few extras--that can be used right out of the box, as well as an Application Programming Interface (API) for extending the standard components or developing brand new components. Validators attached to the components validate user input, which is then automatically propagated to application objects. Event handlers are triggered by user actions, such as clicking on a button or a link, and can change the state of other components or invoke backend application code. The outcome of the event processing controls which page is displayed next, with help from a pluggable navigation handler.

    While HTML is the markup language of choice for most web applications today-- and used for most examples in this book--JSF is not limited to HTML or any other markup language. Renderers that are separate from the UI components control the actual markup sent to the client, so the same UI component coupled with different renderers can produce very different output--for instance, either HTML and WML elements. If you're familiar with Swing, think "pluggable look and feel" (PLAF).

    JSF gives you lots of flexibility in how you actually develop the user interface. All JSF implementations are required to support JavaServer Pages (JSP) as a presentation layer technology, with JSF components represented by JSP custom action elements (also commonly known as custom tags). The JSF API, however, is flexible enough to support other presentation technologies besides JSP. For instance, you can use pure Java code to create JSF components, which is similar to how a Swing UI is developed. Alternatively, you can bind JSF components to nodes in templates described by plain HTML files, the approach explored by projects such as Barracuda/XMLC and Tapestry. I use the JSP layer for most examples in this book because it's the only approach thats completely specified in JSF 1.0, but I also show examples of other approaches.

    If you've developed Java web applications for some time, you've probably heard of (and have likely used) application frameworks like Apache Struts (http://jakarta.pache.org/struts/) or Maverick (http://mav.sourceforge.net/). Even though JSF overlaps a bit with the features offered by frameworks like these (for instance in the areas of validation and navigation support), it's also designed to play well with them. I discuss the options available for Struts applications to use a JSF user interface in Chapter 12, so you'll see exactly how JSF fits together with this popular application framework.

    More Java Articles
    More By O'Reilly Media


       · This article is an excerpt from the book "JavaServer Faces", published by O'Reilly....
     

    Buy this book now. This article is excerpted from chapter one of the book JavaServer Faces, written by Hans Bergsten (O'Reilly, 2004; ISBN: 0596005393). Check it out at your favorite bookstore today. Buy this book now.

    JAVA ARTICLES

    - Deploying Multiple Java Applets as One
    - Deploying Java Applets
    - Understanding Deployment Frameworks
    - Database Programming in Java Using JDBC
    - Extension Interfaces and SAX
    - Entities, Handlers and SAX
    - Advanced SAX
    - Conversions and Java Print Streams
    - Formatters and Java Print Streams
    - Java Print Streams
    - Wildcards, Arrays, and Generics in Java
    - Wildcards and Generic Methods in Java
    - Finishing the Project: Java Web Development ...
    - Generics and Limitations in Java
    - Getting Started with Java Web Development in...







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway