title: Submit HTML Form in Java
body: <p>I am trying to fill in a HTML Form, press a submit button of the form and then get the response from it. </p>
  
  <p>Filling in the form works really well but i can't figure out how to press the submit button on the page.</p>
  
  <p>I am using the apache httpclient libraries.</p>
  
  <p>My code is:</p>
  
  <pre><code>        httpclient = new DefaultHttpClient();
          HttpPost httpost = new HttpPost(pUrl);
  
          List &lt;NameValuePair&gt; nvps = new ArrayList &lt;NameValuePair&gt;();
          nvps.add(new BasicNameValuePair("filter_response_time_http", "1"));
          nvps.add(new BasicNameValuePair("filter_port", "80"));
          nvps.add(new BasicNameValuePair("filter_country", "US"));
          nvps.add(new BasicNameValuePair("submit", "Anzeigen"));
  
          httpost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
  
          response = httpclient.execute(httpost);
  
  
          entity = response.getEntity();
  </code></pre>
  
  <p>The code for the submit button is:</p>
  
  <pre><code>&lt;input onclick="doSubmit();" id="submit" type="submit" value="Anzeigen" name="submit" /&gt; 
  </code></pre>