Introduction to JSF components and the ADF Faces Components
Written by Peter Zadrozny, Oracle Corporation
April, 2005
JSF - a New View on Oracle ADF
In its efforts of trying to make J2EE simpler, Oracle has been providing J2EE best practices, such as design patterns and application infrastructure in a framework it calls ADF (Application Development Framework). What is really interesting with ADF is that it is platform independent, as it will run on any J2EE compliant application server. Better yet, it provides options for every J2EE layer and development life-cycle phase, and you can use anyone you like. You are not forced to use all or nothing.
Oracle ADF is based on the Model-View-Controller (MVC) design pattern. On this article we will focus only on the View layer, which provides the user interface of an application. The view layer uses various markup languages to render the user interface, and it can be web-based, client/server based, a wireless implementation, or even telnet based. The focus is specifically on JavaServer Faces (JSF). Faces, as it's also known, not only provides a view layer, but also a navigation capability, similar to that of Struts and what is called backend beans or managed beans, where you can put your business logic and the interaction with the data sources. With that alone you could start building applications, as Faces is an MVC framework in its own.
Components - the Weapon of JSF
The real power of Faces is the components. The idea is that you don't have to write from scratch the user interface functionality you require every time you need it. Instead you simply use the appropriate component, that way you don't have to mess with the markup language, and it abstracts you away from HTTP. Writing JSF components can be a difficult task, but using them is as simple as a call to a tag. And that is exactly the strength and coolness of Faces. Just imagine having a community of people that contribute Faces components that address pretty much any functionality you would want to have. You would not have to write anymore user interface code, just use Faces components.
The Faces components have an interesting architecture that is based in a clear division of responsibilities. The component itself, which defines the behavior or functionality of the component, and the renderer, which describes the presentation. So, for example, you could have a component define that the user will select only one choice, and in the renderer you would define how this is done, say a radio button or a pull down menu. You can group renderers in render kits, this way you can have a render kit for HTML and another one for WML (mobile phones). The logic of the component remains independent from the device it's being displayed.
Introducing ADF Faces Components
Following that community line of thought, Oracle ADF includes well over 100 JSF components (ADF Faces) that provide end users with a very rich and powerful experience. There are components like color pickers, list of values and calendars, which can be navigated in various ways. There also are some rather complex components, such as tables that include column sorting, and hide-and-show capabilities, as well as tree components that can display data in a hierarchical fashion.
Not all the ADF Faces components are graphical in nature. There are other components that are more oriented to make user interaction simpler, such as the file upload component. There is also a feature of ADF Faces designed specifically for establishing dialogs with users and have the capability to return to the place where they initiated the dialog (something not always easy to do).
Figure 1: ADF Faces dialog framework in action
All these components currently use HTML and WML as the markup languages, so that they can be used indistinctively on a normal browser or a mobile phone or PDA. However, Oracle is in the midst of revamping the renderers of these components by adding a combination of DHTML and JavaScript support, which will provide an even richer user experience, including partial page rendering. This new render kit, called the rich client, is so powerful that it almost deprecates the use of Swing.
Figure 2: ADF Faces.NEXT, a richer component set
Additionally, ADF Faces has a render kit for telnet devices. You might be wondering why, but the sheer amount of telnet devices that exist out there today makes a business case all by it self. Most factories and warehouses use such kind of devices, and they are used on a daily basis.
Figure 3: ADF Faces Telnet render kit in action
Finally we have in the Java/J2EE world a simple way of creating rich and powerful user interfaces. Servlets and JSPs don't really give us much to work with, and Swing is just too much to work for. As you have seen, Faces components are superb, and the components contributed by Oracle ADF Faces are a great point to start. Enjoy!
More Information
For more information about JSF and Oracle JDeveloper 10g (10.1.3) Developer Preview please visit the Oracle JDeveloper home page at Oracle Technology Network.