CGI Server-Side Examples

Hacked around by John Glauert (jrwg@sys.uea.ac.uk) to work at UEA.

Shell Script Interface
(Unix Specific)
Java Source
(Portable)
Description On-Line Example
CgiHello N/A An extremely simple CGI Script that outputs "Hello, World". CgiHello
ShowData N/A A simple CGI script that shows any attached data. ShowData
CgiGet CgiGet.java. Requires CgiShow.java. Note that some browsers will try to interpret the HTML strings in the print statements and the result may be formatted strangely when viewed in the browser. But you can save the file to disk to edit it normally. A simple script that passes the query data from the QUERY_STRING variable to a Java program that builds a page showing the data supplied. CgiGet
CgiCommandLine CgiCommandLine.java A simple script that passes the command-line data to a Java program that builds a page showing the data supplied. Arguments are separated by plus signs ("+") and cannot contain an equals sign ("="). CgiCommandLine
IsIndex IsIndex.java A script that passes the data to a Java program that builds an HTML document that uses ISINDEX. Data-entry page or results page is built depending on whether any data is supplied. IsIndex
CgiPost CgiPost.java A script that invokes a Java program without passing any data to it. The program reads data from standard input. CgiPost.html
ShowParse ShowParse.java. Requires QueryStringParser.java, CgiParser.java, LookupTable.java, URLDecoder.java, and StringVector.java. A script that passes data to a Java program that separates the various attached variables, URL decodes their values, and produces a table of the results. Can accept GET or POST. ShowParse version using GET. See below for a version that sends POST data.
ShowParse ShowParse.java. Requires QueryStringParser.java, CgiParser.java, LookupTable.java, URLDecoder.java, and StringVector.java. A script that passes data to a Java program that separates the various attached variables, URL decodes their values, and produces a table of the results. Can accept GET or POST. AdBuilder.html; sends POST data to ShowParse. See above for a version that sends GET data.
CssTest CssTest.java. Requires CssChoices.java, CookieParser.java, CgiParser.java, LookupTable.java, and URLDecoder.java. A script that passes data to a Java program that builds a page to let you test out cascading style sheet properties. Properties selected are stored as cookies, which are parsed and used as defaults in later sessions. CssTest

Java is a trademark of Sun Microsystems. The original of this document can be found at http://www.apl.jhu.edu/~hall/java/CGI-with-Java. 1996-1998 Marty Hall (hall@apl.jhu.edu).