Using Ajax toolkits is a popular way to make JSF components more interactive.
But multiple Ajax toolkits on the client can produce unintended
consequences, explains ICESoft's Steve Maryka in this interview with
Artima.

One of the key promises of Java Server Faces (JSF) was that it would provide
a standard Java client-side component technology, allowing for JSF-compliant
components to be mixed and matched in an application.

As JSF components become
more sophisticated and interactive, however, developers must increasingly be
careful about component interoperability, according to Steve Maryka, CTO of ICESoft,
a JSF component vendor. The reason has not much to do with JSF itself, but with
the various Ajax libraries sophisticated JSF component rely on in their
implementation.

According to Maryka, the JSF specifications do not say much about
introducing Ajax and JavaScript libraries into the JSF framework. As a result,
JSF component vendors have been using different combinations of Ajax libraries
and in different ways. When using components from multiple JSF
toolkits, the accompanying Ajax libraries can collide in unpleasant ways:

The JSF specification, as it is, never addressed Ajax interaction within the
framework. As you use different technologies, and use different techniques to
make Ajax work within JSF, you're almost certainly are going to run into
issues, whether they be at the framework level or at the component level. There
will be concerns of either JavaScript collisions, or framework collisions,
because the implementations are using different techniques.

For example, many components use XMLHttpRequest to obtain data. If you use
many [different] frameworks, you are going to, at some point, collide in the
number of connections they require. The browser has a limited number of
connections it supports. If you have a bunch of requests going on in the page,
you can have applications that essentially freeze up because the browser can't
handle the connection requirements. You also can get namespace collisions
within the JavaScript itself.

Steve Maryka, CTO of
ICESoft, talks about the dangers of using multiple Ajax toolkits on the client. (6 minutes 15 seconds)

What techniques have you found useful to avoid Ajax framework collision?

About the authors

Frank Sommers is Editor-in-Chief of Artima Developer. He also serves as
chief editor of the IEEE Technical Committee on Scalable Computing's
newsletter, and is an elected member of the Jini Community's Technical Advisory
Committee. Prior to joining Artima, Frank wrote the Jiniology and Web services
columns for JavaWorld.

Bill Venners is president of Artima, Inc. He is author of the book,
Inside the Java Virtual Machine, a programmer-oriented survey
of the Java platform's architecture and internals. His popular columns
in JavaWorld magazine covered Java internals, object-oriented design,
and Jini. Bill has been active in the Jini Community since its
inception. He led the Jini Community's ServiceUI project, whose
ServiceUI API became the de facto standard way to associate user
interfaces to Jini services. Bill also serves as an elected member of
the Jini Community's initial Technical Oversight Committee (TOC), and in
this role helped to define the governance process for the community.