Submitting ASP form from Java application
<p>I am writing a Java application that has a log in screen.  Ideally, I would like to take the user supplied data (name, password), and submit it to an ASP form that can verify their credentials.  I do not own the ASP form, I can only access the URL.  I also do not want the user to be entering their credentials straight into the web form.  They would enter their credentials into my program, and my program would put the data into the form and submit, and allow/deny the user based on the response.</p>

<p>Of course, the submit button on the ASP form is a POST request.  However, constructing the URL (...login?username=name&amp;password=pass) does not work, as the form must be submitted via the button with the text boxes filled in.</p>

<p>I have tried two approaches:</p>

<ol>
<li><p>Using Java's URLConnection class.  This does not seem to work because the form submitting is limited to the method I mentioned above, which is constructing the URL.</p></li>
<li><p>Using Javascript to access and edit the elements on the page.  This has not worked either, because the Javascript is being run from my program, which is not a web browser, and therefore has no access to the 'document' or 'window' commonly used.</p></li>
</ol>

<p>Other potential solutions I can think of:</p>

<ol>
<li><p>Opening a browser to the login page but not giving it focus, running a script to fill out and submit the form, parsing the response, and then closing the browser.  This would not involve the user at all, except for the input into the login page in my Java program.</p></li>
<li><p>Using a 3rd party Java library (suggestions? references to tutorials?).</p></li>
<li><p>Embedding the URL into my login screen (any help in this regard would be appreciated).</p></li>
</ol>

<p>The things that cannot be changed are that my program is in Java, and that the login URL is an ASP form that hides the POST data from the URL.</p>

<p>Let me know if anything needs clarification.  Any help is welcome.</p>
