next up previous
Next: Retrieving form parameters Up: No Title Previous: HTML Form Processing

Form creation - an example

import oracle.html.*;
public class params1 {
  public static void main (String args[]) {
    HtmlHead hd = new HtmlHead("Form Example");
    HtmlBody bd = new HtmlBody();
    HtmlPage hp = new HtmlPage(hd, bd);
    hp.printHeader();

    Form form1 = new Form("POST", 
      "http://tinman.cs.gsu.edu:9001/book/"+
      "java/run/params2");

    Select select1 = new Select("sel");
    select1.addOption(new Option("One"));
    select1.addOption(new Option("Two"));
    select1.addOption(new Option("Three"));
    select1.addOption(new Option("Four"));
    form1.addItem(select1);
    Submit submit1 = new Submit("opt","Option1");
    Submit submit2 = new Submit("opt","Option2");
    bd.addItem(SimpleItem.LineBreak);
    CheckBox cb1 = new CheckBox("chk", "1111");
    CheckBox cb2 = new CheckBox("chk", "2222");
    CheckBox cb3 = new CheckBox("chk", "3333");
    CheckBox cb4 = new CheckBox("chk", "4444");
    CheckBox cb5 = new CheckBox("chk", "5555");
    CheckBox cb6 = new CheckBox("chk", "6666");
    CheckBox cb7 = new CheckBox("chk", "7777");

    form1.addItem(SimpleItem.HorizontalRule);
    form1.addItem(cb1); form1.addItem("1111");
    form1.addItem(SimpleItem.LineBreak);
    form1.addItem(cb2); form1.addItem("2222");
    form1.addItem(SimpleItem.LineBreak);
    form1.addItem(cb3); form1.addItem("3333");
    form1.addItem(SimpleItem.LineBreak);
    form1.addItem(cb4); form1.addItem("4444");
    form1.addItem(SimpleItem.LineBreak);
    form1.addItem(cb5); form1.addItem("5555");
    form1.addItem(SimpleItem.LineBreak);
    form1.addItem(cb6); form1.addItem("6666");
    form1.addItem(SimpleItem.LineBreak);
    form1.addItem(cb7); form1.addItem("7777");
    form1.addItem(SimpleItem.LineBreak);
    form1.addItem(submit1);
    form1.addItem(submit2);
    form1.addItem(new Hidden("dummy_ending","dummy"));
    bd.addItem(form1);
  
    hp.print();
  } // end of main
} // end of class params1



Dr. Raj Sunderraman
7/2/1998