0

I am creating a browser using The Java DJ Project library. I need to create a persistence socket connection from the browser(Client) to a predefined server. I want to put the Server IP address and Port at the browser side(Hard Coded) what will connect with that server. The socket connection could be created by Java or JavaScript. I want to do any option from the following 2 option.

  1. If I create the socket connection using java then there must be a way to send data using that connection from JavaScript. I have an Applet that can do this thing. You can check the solution at this link >> http://stephengware.com/proj/javasocketbridge/ But I don't want to use applet any more. I want to call that Java socket connection from JavaScript or vice versa and send data without adding the applet into the page. I just want to Call javascript function to send date which will use that Java socket.

  2. Or I want to create that connection using JavaScript, but it should be persistence. But if I do so then that connection should be used from Java to send the date.

So will you please tell me the answer of some of my question...

  1. Which method should I apply between 01 or 02 (Described above)? And why?
  2. How to do that? Can anyone please provide me some code to do that?

Would be very happy if anyone answer me.

Partho Biswas
  • 2,100
  • 1
  • 22
  • 37

1 Answers1

0

Seeing as you tagged this JavaEE I would suggest using JavaScript in combination with Servlets(3.0)

You would able to POST towards any of your servers servlet mapping which can read the request with its doPost() method.

For the some code examples see this explanation by BalusC calling servlets using javascript

Community
  • 1
  • 1
Nick Hol
  • 266
  • 1
  • 9