AJAX Tutorial for Java Programmers

Getting Started

Installing the Tutorial Server

In this tutorial, we want to focus on the AJAX details rather than installation and setup issues. There are various different setup scenarios available for Jaxcent, and discussing them will take the focus away from the actual programing.

Therefore, a small server is provided here, that is very easy to install, has Jaxcent pre-bundled, and gets the setup issues out of the way so you can concentrate on the concepts. This server is not very fast, but it is very convenient and easy to set up. It is meant for learning rather than production usage.

The first step is to download the zip file below, and extract its contents.

In this tutorial, we will assume you have created a folder C:\Jaxtut and have extracted the zip file to this folder, so you should have the following on your hard drive:

  • C:\Jaxtut\jaxtut.jar
  • C:\Jaxtut\JaxcentConfig.jar
  • C:\Jaxtut\license.html
  • C:\Jaxtut\html (directory)
  • C:\Jaxtut\java (directory)
  • C:\Jaxtut\api (directory)
(If you are on a non-windows systems, or if you need to use a different path, please adjust the names accordingly.)

Note that you will also get a "solutions" folder -- it is meant to be used after you have finished the exercises on your own! The given solution is just one way of doing the task, and may be interesting to compare with your own solution.

Now double-click the jaxtut.jar file. (If nothing happens, you do not have an association for the ".jar" extension. In this case, bring up a command prompt window, change directory to C:\Jaxtut, and run the command java -jar jaxtut.jar instead.)

You should see the tutorial server comes up. The first time, it will ask you to confirm its setup before starting. The defaults should be ok, make sure they are as follows:

  • Port number should be 80. (If you are already running a server on port 80, you can shut it down while doing the tutorial, or you can change the port number to something else, e.g. 8080. If you are using port 80, the URLs are of the form http://localhost/, but if you are using a port number other than 80, e.g. 8080, the URLs will be of the form http://localhost:8080/)
  • HTML Folder should be C:\jaxtut\html
  • Java classpath should be C:\jaxtut\java
  • Config file should be C:\jaxtut\JaxcentConfig.xml
or as appropriate, if you are on a non-Windows system or have installed in a location different from C:\jaxtut.

Click OK to accept the settings, and minimize the tutorial server.

In the future, you will need to start the tutorial server by double-clicking the JAR file (or by issuing a java -jar command) before running any of the tutorial steps. After the first time, the tutorial server will not ask for any settings. It can be minimized and put out of the way.

To see output from your System.out.println statements, or exception stack traces, un-minimize the tutorial server and look at its output window.

To make sure the tutorial server is installed and running correctly, visit the following location in your browser:

You should see a message saying the tutorial server is working.

You should see two links, both should work.
 

Next Step: Hello World