Java Reference
In-Depth Information
Chapter
4.
Using
Ajax
with
JavaServer
Faces
Technology
Early web applications were created mostly as static web pages. When a static web page
is updated by a client, the entire page has to reload to reflect the update. In effect, every
update needs a page reload to reflect the change. Repetitive page reloads can result in ex-
cessive network access and can impact application performance. Technologies such as Ajax
were created to overcome these deficiencies.
Ajax is an acronym for Asynchronous JavaScript and XML, a group of web technologies
that enable creation of dynamic and highly responsive web applications. Using Ajax, web
applications can retrieve content from the server without interfering with the display on the
client.
In the Java EE 6 platform, JavaServer Faces provides built-in support for Ajax. This chapter
describes using Ajax functionality in JavaServer Faces web applications.
The following topics are addressed here:
• “ Overview of Ajax on page 70
• “ Using Ajax Functionality with JavaServer Faces Technology on page 70
• “ Using Ajax with Facelets on page 71
• “ Sending an Ajax Request on page 73
• “ Monitoring Events on the Client ” on page 75
• “ Handling Errors on page 76
• “ Receiving an Ajax Response ” on page 77
• “ Ajax Request Lifecycle ” on page 78
• “ Grouping of Components on page 78
• “ Loading JavaScript as a Resource on page 79
• “ The ajaxguessnumber Example Application on page 81
• “ Further Information about Ajax in JavaServer Faces Technology ” on page 85
Overview of Ajax
Ajax refers to JavaScript and XML, technologies that are widely used for creating dynamic
and asynchronous web content. While Ajax is not limited to JavaScript and XML techno-
logies, more often than not they are used together by web applications. The focus of this
Search WWH ::




Custom Search