How Servlet Applet communication achieved?

Showing Answers 1 - 4 of 4 Answers

Abhinandan Patil

  • Sep 15th, 2005
 

Use URLConnection class and call URLConnect. openConnection & URLConnection.connect method

  Was this answer useful?  Yes

Vinod

  • Apr 26th, 2006
 

 U have to use two functions

  1: readUTF(); 2: writeUTF();

  Was this answer useful?  Yes

Shaik

  • Oct 20th, 2007
 

Servlet - Applet communication can be achieved in the following way.

a) Type the following code in your applet.

  //The path of the servlet needs to be passed as input param to URL Class.

  URL urlObj = new URL(http://server/servlet?var1=1&var2=2);

  URLConnection uConn = ulrObj.openConnection();

  // set the MIME type if required. i.e setContentType("");

  InputStream isObj = uConn.getInputStream();

b) We can read response of the servlet from 'isObj' by iterating.



Thanks

A.R.Shaik

  Was this answer useful?  Yes

Create a URL.
Retrieve the URLConnection object.
Set output capability on the URLConnection.
Open a connection to the resource.
Get an output stream from the connection.
Write to the output stream.
Close the output stream.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions