Java Reference
In-Depth Information
tutorial is on using JavaScript based Ajax functionality in JavaServer Faces web applica-
tions.
JavaScript is a dynamic scripting language for web applications. It allows users to add en-
hanced functionality to user interfaces and allows web pages to interact with clients asyn-
chronously. JavaScript runs mainly on the client side (as in a browser) and thereby reduces
server access by clients.
When a JavaScript function sends an asynchronous request from the client to the server,
the server sends back a response that is used to update the page's Document Object Model
(DOM). This response is often in the format of an XML document. The term Ajax refers
to this interaction between the client and server.
The server response need not be in XML only; it can also be in other formats, such as
JSON. This tutorial does not focus on the response formats.
Ajax enables asynchronous and partial updating of web applications. Such functionality
allows for highly responsive web pages that are rendered in near real time. Ajax-based
web applications can access server and process information and can also retrieve data
without interfering with the display and rendering of the current web page on a client (such
as a browser).
Some of the advantages of using Ajax are as follows:
• Form data validation in real time, eliminating the need to submit the form for veri-
fication
• Enhanced functionality for web pages, such as user name and password prompts
• Partial update of the web content, avoiding complete page reloads
Using Ajax Functionality with JavaServer Faces Technology
Ajax functionality can be added to a JavaServer Faces application in one of the following
ways:
• Adding the required JavaScript code to an application
• Using the built-in Ajax resource library
In earlier releases of the Java EE platform, JavaServer Faces applications provided Ajax
functionality by adding the necessary JavaScript to the web page. In the Java EE 6 plat-
form, standard Ajax support is provided by a built-in JavaScript resource library.
With the support of this JavaScript resource library, JavaServer Faces standard UI com-
ponents, such as buttons, labels, or text fields, can be enabled for Ajax functionality. You
can also load this resource library and use its methods directly from within the managed
Search WWH ::




Custom Search