Chapter 18: CGI Programming and Beyond -- The Server Side
This chapter of
Core Web Programming (pages 972-1036) explains how to implement
CGI programs. It covers all of the CGI environment variables and
how to receive data via the command line, and
explains how to handle GET and POST requests. Also presents a complete
form parser and cookie parser in Java, as well as discussing
server-side Java via the servlet API instead of through traditional
CGI. Finishes with an overview of other CGI alternatives.
Note: this page primarily covers the information on "traditional" CGI with
Java covered in the first edition of CWP. For information on the
much faster and more powerful approach of using servlets and JSP, please
see Core Servlets and JavaServer Pages.
Source code and PDF version of entire book online for free access.
Contents
The shell scripts are Unix-specific, and must
be set executable and placed in the CGI directory.
Reminder: On Windows 95/NT and Unix, click on the links with
the right mouse button to save the referenced file to a new location.
On any platform, you can also click on the links with the SHIFT key
held down. On Netscape, this lets you save the source for the
referenced file to a new location. In Internet Explorer, this puts the
referenced file in a separate browser window (without frames), where
you can then save it.