Introduction to the WebADF

Summary The ArcGIS Server Java platform provides a set of components that can be used to create a Web-based mapping and analysis application. These components not only provide a broad array of functionality out of the box, but they have also been designed to allow for easy extension, working with multiple data sources, such as ArcGIS Server and ArcIMS. The Web Application Developer Framework (ADF) controls and framework are JavaServer Faces (JSF) components for working with geographic data sources. By using the JSF framework, you can leverage an ecosystem of JSF components from ESRI and other vendors to quickly build interactive Web-based geographic information system (GIS) applications.

In this topic

JavaServer Faces

The following information is from the JSF project home page:
"JavaServer Faces technology simplifies building user interfaces (UIs) for JavaServer applications. Developers of various skill levels can quickly build Web applications by assembling reusable UI components in a page, connecting these components to an application data source, and wiring client-generated events to server-side event handlers."
JSF is a Java specification that defines a model for graphical user interface (GUI) components, an event-driven programming model, and a framework for producing applications that have a clean separation of presentation logic from application logic. For those familiar with desktop development in Java, consider JSF as Swing on the server.


JSF is built around a framework that insulates the application developer from many of the tedious details of creating Web applications. For example, in a servlet-based application, getting an integer parameter called NumberOfItems from a form into a Java class would require the following code:
// Get an integer from a servlet.
String numberOfItemsString = (String)request.getParameter("NumberOfItems");
int numberOfItems = Integer.parseInt(numberOfItemsString);
JSF simplifies the cumbersome parts of working with the Web tier.
The framework underpinning JSF enables you to create applications that follow the Model-View-Controller (MVC) pattern. By using this pattern, you can create applications that cleanly separate business logic from presentation logic, thereby increasing application maintainability and flexibility. For a JSF application, the model consists of the business logic, which could be Plain Old Java Objects (POJOs) or Enterprise JavaBeans (EJB). The view is provided by GUI components that usually render Hypertext Markup Language (HTML) to the client's browser. The controller is a servlet interacting with numerous Java classes, allowing it to control interaction between the model and view tiers as well as overall application navigation. State of the application and requests are also handled by the framework, which allows for capabilities such as validation, providing messages to end users, and various other stateful functionality.
Configuration of the servlet and many other aspects of the application are controlled through an Extensible Markup Language (XML) file. Typically, this file is faces-config.xml, and it contains information on which Java classes will be managed through the framework (managed beans), the name that JavaServer Pages (JSP) tags use to refer to the Java classes (using JSF expression language [EL]), and the page flow logic for the application. For the ArcGIS components, this file plays a critical role in establishing the relationship between different components.

GUI components

The UI components specified by JSF bring both standardization and flexibility to UIs in Java Web applications. These components concentrate on providing the view tier to the MVC architecture. As such, they contain only the properties and methods needed for rendering data from the model tier and accepting interaction from the end user. You can rapidly wire components together, both from the same vendor as well as between different vendors, to create highly functional applications.
The type of output that a component generates is governed by its render kit, allowing the same components to generate XML, HTML, Portable Document Format (PDF), or other forms of output. JSF technology is designed to allow for the specification of different render kits during both application development and run time.
User interaction is also covered through the graphical components. The rendering of forms and the actions that occur when values are changed or buttons are pressed all derive from the components. The JSF standard also allows for the binding of validators to form elements, ensuring the quality of input data.

Business logic

Your business logic will be contained in Java classes. JSF is flexible in the way you create your classes in relation to your JSP pages. Some application developers create a single class for each page, which contains a property for an element on the form. These developers then create a separate class to handle methods that are called when a user clicks a submit button or performs a request to the server. Some developers include these in one class. Other developers perform some variation on this with the beans acting as an intermediary layer to the real business objects underneath. For example, the method called with the Submit button delegates calls to an EJB and, depending on the value returned from the EJB, returns different values to the controller. All the Java classes that interact with the controller and view tier are managed beans, since they are managed by the JSF framework. Furthermore, the beans that hold the values from the form are called backing beans, since they can be thought of as backing a form.
There are several methods to allow JSPs to call methods in your Java classes. Much like Java Swing, the JSF architecture allows you to have events and listeners. In the case of JSF, events and listeners can be associated with an action, such as a button click; a value change, such as the user changing the text in a form element; or with a phase of the event-processing lifecycle. For your Java class to use these actions or listeners, it must implement a specific interface or inherit from a certain class. However, you can also write a POJO with methods that return strings, and use this in your framework. By using the JSF method binding EL, you can call these methods and the string returned will tell the servlet which page is next in the application flow.

Additional JSF information

This is only a brief introduction to the JSF framework. To understand the rest of the documentation for the ArcGIS JSF components, you will need a better understanding of JSF. In particular, you will need to understand the faces-config.xml structure, the event model, the phases of a JSF request, managed and backing beans, JSF EL, and JSF JSP tags.
Two books covering JSF are the following:
  • Kito Mann's JavaServer Faces in Action provides a good introduction to JSF, as well as covering some interesting use cases, such as JSF-Struts integration.
  • David Geary and Cay Horstmann's Core JavaServer Faces is a thorough coverage of the JSF framework.
Online resources are listed in the See Also section.

See Also:

Java EE 5 Tutorial from Sun
Online tutorials from Excadel
JSF series by Rick Hightower at DeveloperWorks
Official JSF forums page
JSF tutorials page
Overview of the Web ADF architecture