Ajax is not technology, its way to refresh or show some contexts on your page without need to submit all page back to server, it uses XMLHttpRequest ActiveX object to send request. Here is simple example:
In javascript on page there is function:
function testAjax()
{
var http=null;
try {
http = new ActiveXObject(”Msxml2.XMLHTTP”); //IE
}
catch (e)
{
http = new XMLHttpRequest(); //Mozila,safari
}http.open(”GET”,”servlet/command.Ajax”,true);
http.onreadystatechange=function()
{
if (http.readyState==4)
{
alert(http.responseText);
}
}
http.send(null);
}

And servlet that we call:

public class Ajax extends HttpServlet {

public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
try
{
resp.setContentType(”text/html”);
PrintWriter out=new PrintWriter(resp.getOutputStream());
out.print(”TEST”);
out.close();
}
catch(Exception e)
{
}
}
public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
}
}

If you put some button on page and onclick event call testAjax() function it will print “TEST”.

This is very simple example, instead of showing alert, with innerHTML you can change context of some other element on page.

Also instead of calling servlet, you can call xml or URL.