Results 1 to 1 of 1
  1. #1
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default Filling out HTML forms.

    Ok guys, I am trying to write a simple program that will log in to a webpage and store a cookie. So far, I have no idea where I'm supposed to start. I have been digging in URLConnection and HTTPConnection but I don't understand what part of it is actually submitting post data. I don't want to use the Robot class because I don't want the program to interfere with the user, so I'm using URLConnections.

    These are the two fields I am working with
    Java Code:
    <div style='position:relative;'><input type="text" id="username" name="user[login]" value="" class="btipsy" title="Enter your username." /></div>
    <div style='position:relative;'><input type="text" id="username" name="user[login]" value="" class="btipsy" title="Enter your username." /></div>
    I know that .setDoOutput(true) triggers a post fire over a get fire. I think that .setRequestProperty is what I'm looking for, but I don't understand how to use it.

    EDIT: As far for handling cookies, I was digging through the CookieStore and that will probably be what I need for that. However I can't seem to find any good ones for URLConnection submitting to forms.

    EDIT 2: From what I can tell this might not be possible with just URL gets and posts, and people keep giving advice to other people in older threads to use things like http://htmlunit.sourceforge.net/ Are they correct in saying this?

    If someone could point me in the right direction on where to start for this that would be great.
    Last edited by Dark; 04-10-2013 at 06:15 PM.
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

Similar Threads

  1. Filling with transparency
    By zirbinator in forum Java 2D
    Replies: 3
    Last Post: 02-09-2011, 02:36 AM
  2. Filling a JTable
    By aborgeld in forum Advanced Java
    Replies: 0
    Last Post: 01-08-2011, 01:37 PM
  3. Submitting HTML forms through Java help
    By MysticalMagnet in forum New To Java
    Replies: 4
    Last Post: 11-14-2010, 01:41 AM
  4. Filling Arrays??
    By Bgreen7887 in forum New To Java
    Replies: 8
    Last Post: 11-04-2010, 06:51 AM
  5. Replies: 2
    Last Post: 04-28-2008, 10:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •