title: Passing data to an html POST form using Java
body: <p>I have an HTML form that looks about like this:</p>
  
  <pre><code>&lt;form name="form1" method="post" action="/confirm.asp"&gt;
      &lt;input type="text" name="data1" size="20" value=""&gt;&lt;br&gt;
      &lt;input type="text" name="data2" size="20" value=""&gt;&lt;br&gt;
      &lt;input type="Submit" name=submit value="Submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I want to use Java to pass data to<code>data1</code> and <code>data2</code> and read the page that follows when the form is submitted. Since this is a method=post, I cannot use <code>http://somesite.com/confirm.asp?data1=foo&amp;data2=foo</code>.</p>
  
  <p>Can one please help?</p>