Get input box value

Hi

I’m writing a Java server that reads a text file and displays some of the information in a browser. Here is my code to display the info in the browser.

private void browserDisplayBeginning(String question) throws IOException
{
      String contentBodyStart=
          "<HTML>" + "<BODY>" +  "<div align = \"center\">" + "<form action=\"\" method=\"get\">" +  "<h2>" + question + "? </h2>" + "</div>";
      out.println(contentBodyStart);
}
   
private void browserDisplayMiddel(String answer, int number) throws IOException
{
      String contentBodyMiddel = "<div style=\"margin-left:350px\"><p>" + number + ") " + answer + "</p></div>";
      out.println(contentBodyMiddel);
}
   
private void browserDisplayEnd() throws IOException 
{
      String contentBodyEnd =
         "<div align = \"center\">" +                                                                       "Answer:<input type=\"text\" name=\"answer\" size=\"20\">" +
              "<input type=submit name=\"submit\" value=\"Submit\">" +
              "<input type=submit name=\"reset\" value=\"Reset\">" +
              "</div> </br>" + "</form>" + "</BODY>" + "</HTML>" ;
      out.println(contentBodyEnd);
      getOutput();
}

I’m now trying to the value the user typed in the input box, i.e.
GET http://d:55555/?[COLOR=#3366ff]answer=3[/COLOR]&submit=Submit HTTP/1.1

How do I get this value?
I tried something like this, but it didn’t work.

String line;
  while((line = in.readLine()) != null) 
  {
      if (line.length() == 0) break;
      out.println(line);
  }
  int start = line.indexOf("GET") +7; 
  int end = line.indexOf("HTTP/") + 5;
  String extracted = line.substring(start, end - 1);
  System.out.println(extracted);

Any ideas on how I can get that value? (I don’t want to use an applet)