Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Is it possible to communicate from an applet to servlet and how many ways and how?

0
Posted

Is it possible to communicate from an applet to servlet and how many ways and how?

0

Ans: Yes, there are three ways to communicate from an applet to servlet and they are: a) HTTP Communication(Text-based and object-based) b) Socket Communication c) RMI Communication (You can say, by using URL object open the connection to server and get the InputStream from URLConnection object). Steps involved for applet-servlet communication: 1) Get the server URL. URL url = new URL(); 2) Connect to the host URLConnection Con = url.openConnection(); 3) Initialize the connection Con.setUseCatches(false): Con.setDoOutput(true); Con.setDoInput(true); 4) Data will be written to a byte array buffer so that we can tell the server the length of the data. ByteArrayOutputStream byteout = new ByteArrayOutputStream(); 5) Create the OutputStream to be used to write the data to the buffer.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123