next up previous
Next: Formatting HTML Tables Up: No Title Previous: Multivalued form parameters

Processing form parameters

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

    String parameter1 = getArgument(args,"sel");
    hp.addItem(new SimpleItem(parameter1))
      .addItem(SimpleItem.Paragraph);

    for (int i=0; i < args.length; i++) {
      if (args[i].startsWith("chk")) {
        String parameter2 = args[i].substring(4);
        hp.addItem(new SimpleItem(parameter2))
          .addItem(SimpleItem.Paragraph);
      }
    }

    String parameter3 = getArgument(args,"opt");
    hp.addItem(new SimpleItem(parameter3))
      .addItem(SimpleItem.Paragraph);

    hp.print();
  }
} // end of class params2

  private static String getArgument(String args[], 
                                    String name) {
    String prefix = name + "=";
    for(int i = 0; i < args.length; i++)
      if (args[i].startsWith(prefix))
        return args[i].substring(prefix.length());
    return null;
  }



Dr. Raj Sunderraman
7/2/1998