-
Post&submit text to a form in java
Hello all,
I am a Java developer and am wondering how do I use a java program to post to form and fill in some text on webpages?
example: do a program that posts a message to:
http://long_john321.t35.com
thats a site done by me to test this.
I would be thankful if anyone would tell me how to do this or give a hint to a program w/ source, howto, tutorial or book.
Thanks!
-
 Originally Posted by long_john321
I would be thankful if anyone would tell me how to do this or give a hint to a program w/ source, howto, tutorial or book.
Thanks!
Here's a link to some opensource web-crawlers written in Java:
http://www.manageability.org/blog/st...lers-java/view
Good luck.
-
Not sure what you are asking.
Is the code you want going to run on a server or on a client?
On a client your java program would do a HTTP GET to a server, get its HTML with the <FORM and then create the needed response and send it back to the server following the rules specified in the ACTION= tag.
-
What you need to do is JSP and servlets.
JSPs are webpages with java built in and servlets are used to use information in a form. There are two types of methods POST and GET both do the same thing. If you research servelts and JSPs they should be of help to you.
-
Okay thanks for all the good info! But I think some ppl have misunderstood my question:
These are the premises:
*It needs to work for a PHP site (like the one I made) /no jsp,cgi
*I dont need to have the sourcecode, that means the program is like doing it "manually" in a webbrowser but no clicking.
*pure client-side program of course
Short summary: if you cant get the idea/program/pseudocode to work for my site I provided then its not the right program, im afraid
And Norm, could I get some pseudocode on that idea you had?
-
client to web, auto...let's see:
- client wsave some data to a db, put a status flag=0
- on load, let the form web page xtraxt from a db, change the flag to 1
workable?
-
I assume that the java program you are talking about will run on a client machine and will do what a user might do with a browser. Ie read a web page with a <Form, fill in the fields/check the boxes and submit the results to the server.
I don't know how to parse an unknown <Form. Perhaps there are classes to do that.
If you know what the <form looks like, you can build a URL with the response fields set as needed and send it back to the server.
If there is a parser for the HTML <Form, then the job is a little harder, but doable.
In the doc you need to look at the format for the URL sent by a client when 'Submit'ing a <form.
There is GET and POST to consider.
There also might be Cookies to return to preserve state on the server.
Similar Threads
-
Replies: 2
Last Post: 04-17-2009, 11:14 AM
-
By Lori Piquet in forum Talk to the Editors
Replies: 114
Last Post: 10-10-2002, 06:01 AM
-
By Glen Kunene in forum Talk to the Editors
Replies: 17
Last Post: 03-23-2002, 01:43 AM
-
By Khalid Al-Tayaran in forum Java
Replies: 1
Last Post: 02-18-2002, 08:24 PM
-
By George Gilbert in forum vb.announcements
Replies: 0
Last Post: 08-19-2001, 11:34 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
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|