7.6 Looking Ahead to JavaServer FacesJavaServer Faces (JSF) is designed to provide a standard set of JSP tags and Java classes that will make it easier to build Java server application GUIs. One of the problems that JSF is trying to address is that the Servlet and JSP technologies don't provide specific enough APIs for creating the client GUI, and developers have to rely on HTML components and one of several alternatives to facilitate style and behavioral changes to all of the views. The mechanism to manage all of this eventually takes on a life of its own and overshadows the business of the application. Instead of performing maintenance on business operations and logic, more and more time is needed to manage the presentation controls. JSF plans to fix this by creating a standard way to define complex HTML forms and other GUI elements. This will enable developers to focus their attention on a single component framework. The first release of the framework includes the following design goals: Create a standard GUI component framework, which can be leveraged by
development tools to make it easier for tool users to both create
high-quality GUIs and manage the GUIs' connections
to application behavior. Define a set of simple, lightweight Java base classes for GUI
components, component state, and input events. These classes will
address GUI lifecycle issues, notably managing a
component's persistent state for the lifetime of its
page. Provide a set of common GUI components, including the standard HTML
form input elements. These components will be derived from the simple
set of base classes (outlined in #2) that can be used to define new
components. Provide a JavaBeans model for dispatching events from client-side GUI
controls to server- side application behavior. Define APIs for input validation, including support for client-side
validation. Specify a model for internationalization and localization of the GUI. Automate the generation of appropriate output for the target client,
taking into account all available client configuration data (browser
version, etc.). Automate the generation of output containing required hooks for
supporting accessibility. 7.6.1 What Does JSF Have to Do with Struts?JSF and Struts should fit together quite well, and developers eventually will be able to supplement or substitute the Struts custom tag libraries with JSF components. The rest of the Struts framework (both model and controller components) will remain relatively unaffected by the JSF architecture.
Because there currently is no final public specification for JSF, it's hard to be specific on exactly how the two will tie into each other. However, Craig McClanahan, the founder of the Struts framework, is now also one of the specification leads for the JSF JSR. We can look closely at Craig's comments on JSF and Struts and know that he is speaking with subject-matter expertise. In fact, Struts 1.1 ships with an early look at how the two might fit together. If you look in the contrib folder under the Struts binary installation, you will find a directory named struts-faces. This directory contains a library which supports the use of JSF in a Struts-based application. There are also a couple examples that you can actually run in a container and see JSF work first hand. For more information on this library and JSF in general, see Chapter 18. You can find the JSF JSR online at http://jcp.org/jsr/detail/127.jsp. |