Java and AJAX programming: introduction

AJAX is a methodology for web programming that allows more "interactive" pages to be created. The term AJAX means the technique of making server requests from the browser without completely replacing the current web page. The idea is that a given web page includes some JavaScript (or some other client-side script) that:

Thus, we depart from the traditional model where every page update involves completely replacing the current page with a new one when the user clicks on a link.

The essential ingredient that makes AJAX programming possible is the XMLHttp ActiveX object (in Internet Explorer), or its equivalent XMLHttpRequest object on other browsers. This component makes it convenient to send server requests (and process responses) from JavaScript, particularly in XML format. Thus, AJAX actually stands for Asynchronous Javascript and XML. There's no actual obligation to use XML when transferring data to/from the server. But if you do, both JavaScript (on the client) and Java (on the server) provide facilities for dealing with XML, so for fairly structured data it's a reasonable choice.

What's involved in AJAX programming?: methodology overview

The typical steps and methodology for writing an AJAX application with Java and JavaScript involve the following, which we look at over the next few pages:

In many AJAX applications, we also need to manipulate the CSS attributes of HTML elements, in order to make them appear, disappear, change position etc.


If you enjoy this Java programming article, please share with friends and colleagues. Follow the author on Twitter for the latest news and rants.

Editorial page content written by Neil Coffey. Copyright © Javamex UK 2021. All rights reserved.