// This appears in Core Web Programming from // Prentice Hall Publishers, and may be freely used // or adapted. 1997 Marty Hall, hall@apl.jhu.edu. public class CgiShow { public static void main(String[] args) { CgiShow app = new CgiShow("CgiShow", args, "TEST"); app.printFile(); } protected String name; protected String[] args; protected String type; public CgiShow(String name, String[] args, String type) { this.name = name; this.args = args; this.type = type; } public void printFile() { printHeader(); printBody(args); printTrailer(); } protected void printHeader() { System.out.println ("Content-Type: text/html\n" + "\n" + "\n" + "\n" + "\n" + "The " + name + " Program\n" + "\n" + "\n" + "\n" + "\n" + "

The " + name + " Program" + "

"); } protected void printStyleRules() { System.out.println ("H1 { text-align: center;\n" + " font-family: Arial, sans-serif }"); } protected void printBody(String[] data) { System.out.println("(Generic CgiShow)"); } protected void printTrailer() { System.out.println("\n"); } }