CGI stands for common Gateway Interface. Mainly, this is a technology that
allows you to take some information from the client, make some processing and
return some results to the client. All the above things are achieved by writing
a CGI script. This is an (almost) ordinary program, which can be written in ANY
language (C++ and Perl are the most used). This script runs on a single machine
(the server), so it doesn't need portability. Instead, the speed is critical, so
Java might not be the best solution to write it. Anyway, it can be done in Java
too.
So, the client passes the request to the server by sending several parameters
(name-value pairs) in two basic ways:
- by query string (the parameters are appended to the URL)
- by environment variables (the parameters are encapsulated in the body of
the HTTP request)
Either way, when you write the script (a Java program in your case), you will
read the parameters, take the needed actions and than respond to the client
request, most commonly by producing an output for the browser.
Now, if you'll read the first one or two chapters from any CGI book, you will
learn how to do it (at least for the simpler and more common things).