• Post Reply Bookmark Topic Watch Topic
  • New Topic

Javascript from Java  RSS feed

 
Graham King
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

From a java program I need to submit information which is entered into a javascript form textarea and submitted via a submit command.

The webpage in question is: http://pgp.mit.edu/.

I have already managed to do the "Extract a key" thing using URL class in java but now I need to "Submit a key"

Does anyone have an idea how to do this? I guess the difference is that with "Extract a key" all of the info is encoded in the URL, with "Submit a key" it is not.

Oh, just one final note, obviously I can not change the javascript, but the java...i'll give it a sex change if it helps!

Any help would be greatly appreciated.

Thanks
 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't believe there's any JavaScript on that page--just HTML (details, details). Now, on to the important stuff...to do a form POST with parameters, I would think the easiest thing might be to use the Apache Commons HttpClient. Version 2 should suffice for your needs (I think 3 is in beta). You can browse the sample code and tutorial links, but basically, you're more or less going to do something pretty simple, like this:




You can check my memory against the API.



Hope that helps!
 
Graham King
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortunetly I have to go to work and I've not had time to test out your code, but dude, if that works...I'm gonna have to buy u an e-beer!!

I'll let u know how it goes!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!