Access FREE BIRT Developer Tools from Actuate:
Webinar:
Automate Secure Report Delivery
Demo:
Web-based Report Creation for End Users
Demo:
Automate the Creation of Spreadsheet Reports

Back to Article

JavaServer Faces, Web Applications Made Easier

By Mike Houghton

Introduction

The Java Community Process (JCP), in an effort to keep Java in the forefront of Web Applications, has come up with a specification called JavaServer Faces (JSF), which attempts to standardize the way we develop Java Web applications and provides a set of rich ready-to-use UI components. In this article, I'll try to discuss the JSF technology, what's wrong, what's right and why it's necessary.

Lets start by taking a look at what JavaServer Faces is and what it can do for you.

Getting Started

To begin, JavaServer Faces (JSF), also known as JavaServer Release 127 (JSR 127) is a user interface framework designed to aid in building Java-based web applications. These applications will run on the server side of the process and will render the user interface side back to the client. The client interface portion runs on the server and not the client and yet JSF responds to events generated on the client side.

You can think of JSF as a combination of Struts (an open source JSP-based framework application) and Swing (the standard Java framework application). However JSF is not a replacement for Struts or Swing. In fact JSF has been designed to work quite well with both.

Below is a quick summary of the six main areas that JSF either improves on or now offers for Java developers:

  1. It will allow developers to create user interfaces from a set of standard, reusable server-side components.
  2. It provides a set of JSP tags to access server-side components.
  3. It encapsulates event handling and component rendering so that developers can use standard JSF components or custom components that support markup languages other than HTML such as Norpath or XWT.
  4. It transparently saves the state information and repopulates the forms when they redisplay.
  5. It now allows tool vendors to develop IDEs for a more standard Web application framework.
  6. It also provides the framework for implementing custom components.

JSF is very efficient, handling HTTP requests in only seven distinct phases. To help understand the flow of information, take a look at the chart below.

Java Server Faces Flow Chart

The process of control is shown with solid lines and the dashed lines show the alternate flow allowing for a page redisplay and validation request or in the event of a conversion error.

There are several other components involved, however these are the key elements to this process. As you can see, what makes it different from other servlet/JSP applications is that JSF has an event-driven nature versus being JSP-centric. This is an important characteristic of a JSF application.

Notable Advantages

Although covering all the aspects of the JSF framework and discussing the best practices behind using it JSF is simply not possible in just one article, the following section discusses some of the reasons why so many developers are using this standardized Java Based Web Application Developing tool.

The primary design of JSF is to simplify Java web application development by providing a standard web user interface framework. In that its standard means that vendors such as IBM, Oracle, Sun and Borland will support this design. With this kind of support developers can visually build web pages by dragging and dropping user interface components for the client side and connecting them to the server-side using data sources, JavaBean classes and event handlers. This means that for most development projects, your team will have tools for developing JSF apps. You won't need to waste time wading through some 20 different framework tools to find the one that best suits your projects needs and that means there should be a solution ready to go, right out of the box.

Advantages to Using a Standard Frameworks Design

  • JSF being a specification of Sun, means that it will be included in all future versions of the J2EE specification standard and just about all major vendors have pledged strong support for JSF.
  • JSF uses the "Page Controller Pattern" and therefore aids in Page rich applications. Components can respond to events from components on a given page.
  • JSF has well-defined request lifecycles allowing for plugability at different levels. An example of plugability is the ability to build your own render toolkit and to separate the rendering portion from the controller portion of the framework. In addition, the render toolkit is not tied to JSP.
  • Because JSF has a rich component model. This favors a Rapid Application Development(RAD) style of development using drag and drop technology.
  • JSF gives the developer a way to link visual components to back model components without breaking the layering.

Minor Disadvantages

  • JSF is still quite new and evolving. It will take some time to see successful deployments and wide usage. In addition, as vendors write components, they may not do everything you want them to.
  • Developing with JSF by hand may not be easier than Struts for some. The goal of JSF was more oriented to RAD.
  • Long time Struts users may find navigation of Struts just a bit more flexible and adhere to more complex controller logic

Conclusion

There are many obvious reasons why JavaServer Faces is becoming the standard framework. Although it's still new, much development has gone into its predecessor. With Craig McClanahan behind the creation of Struts and also serving as the specification co-lead for JavaServer Faces, there is no doubt that both JSF and Struts will continue to coexist for some time. The Struts and other development communities are well aware of JSF and are positioning themselves to include strong support for JSF. This will help further make this the standard. Ultimately JavaServer Faces will provide a standard framework for developing extensible Web-based UI applications with quick turnaround times for your developme JSF is a step in the right direction towards rapidly developing fully loaded Web framework applications. nt teams.

Article Resources

Information on Struts Framework Application

Information on Swing

Information on Cocoon

Information on XWT

Information on Norpath

JSP

JSF

Access FREE IBM Software Construction Tools:
eKit:
Simplify the Creation of SIP Applications
Webcast:
Hacking 101--Top 10 Attacks in Web Apps
Whitepaper:
Best Practices for Software Analysis
Webcast:
Smart Agile Development Within Dispersed Teams