3 Replies - 1826 Views - Last Post: 09 February 2011 - 10:06 PM

#1 xor-logic  Icon User is offline

  • HAL9000 was an Apple product
  • member icon

Reputation: 128
  • View blog
  • Posts: 764
  • Joined: 04-February 10

Using Javascript and Java together?

Posted 09 February 2011 - 08:34 PM

I'm trying to complete a challenge on another site that requires me to load a page, get the source code for the page, parse out some info, do something with it and fire it back to the site within a specified time period. I've built a program in Java to take the input and get it ready to be shot back.

The problem is that I'm having a huge headache trying to get my Java code to communicate with their server, so I was hoping I might be able to accomplish a workaround:

Is there a way to enter a short Javascript program in the url bar that would run the .class file with parameters, receive a String from that program, paste it into the DOM and submit? Everything would be executed client-side on my machine.

I'm not sold on doing it that particular way, I'm just hoping to use Javascript to let Firefox handle the communicating for me.

Is This A Good Question/Topic? 0
  • +

Replies To: Using Javascript and Java together?

#2 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10693
  • View blog
  • Posts: 39,770
  • Joined: 27-December 08

Re: Using Javascript and Java together?

Posted 09 February 2011 - 09:31 PM

Javascript isn't the way to go here. Take a look at the URL class for opening an InputStream from and an OutputStream to a particular site for reading and POSTing data to the page.
Was This Post Helpful? 1
  • +
  • -

#3 xor-logic  Icon User is offline

  • HAL9000 was an Apple product
  • member icon

Reputation: 128
  • View blog
  • Posts: 764
  • Joined: 04-February 10

Re: Using Javascript and Java together?

Posted 09 February 2011 - 10:04 PM

Mac, I know that's the RIGHT way to do it, but I've been having so many issues trying to do it that way I just wanted to see if I could find a workaround, like letting Firefox handle the communication part of it. :)
Was This Post Helpful? 0
  • +
  • -

#4 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10693
  • View blog
  • Posts: 39,770
  • Joined: 27-December 08

Re: Using Javascript and Java together?

Posted 09 February 2011 - 10:06 PM

Having the browser handle this is a bad idea. You can use Javascript with Java in Java EE projects, but this isn't applicable here. If you are experiencing issues, better to post your code and errors. :)
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1