# Get input box value

**URL:** <https://forum.kirupa.com/t/get-input-box-value/305769>\
**Category:** programming\
**Created:** [March 3, 2010, 10:27am UTC](https://forum.kirupa.com/t/get-input-box-value/305769 "2010-03-03T10:27:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gooo](https://avatars.discourse-cdn.com/v4/letter/g/eb8c5e/32.png) [@Gooo](https://forum.kirupa.com/u/Gooo)\
**Post date:** [March 3, 2010, 10:27am UTC](https://forum.kirupa.com/t/get-input-box-value/305769/1 "2010-03-03T10:27:43Z")

</div>

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.

```auto
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/](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.

```auto
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)
