Ajax Fundamentals

Ajax is fundamentally a simple three-step process:

  1. Invoke a URL from JavaScript code on the client.
  2. Handle the URL on the server and write to the response.
  3. After the response is complete, integrate the response into the DOM.

Those steps are almost identical to what JSF does when you click a link that illicits a request. JSF handles that request on the server by ultimately writing to the response, which overwrites the preceding response.

The same applies for Ajax requests, except for the last step. In an Ajax request, we don’t refresh the entire page; instead, we update only part of the page. That subtle difference lets us perform all kinds of interesting interactions that were heretofore unheard of in Web applications.

To ...

Get AJAX and JavaServer™ Faces now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.