In howmany ways applet-servlet communication can be done?

Answer Posted / janet

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
(u can say by using URL object open the connection to
server and get the InputStream from URL connection 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 w
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.
DataOutputStream out=new DataOutputStream9byteout);

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we override servlet service method?

591


Name the packages that work with servlet?

547


Write all the phases defined in servlet life cycle?

589


How do I know if java is running on linux?

607


What are the two important api's in for servlets?

590






Name the different ways of session tracking.

571


How forward () method is different from send redirect () method?

517


Explain the differences between jsp and servlet.

546


What is called servlet mapping?

558


What is servlet container. how it works?

617


Given the request path below, which are context path, servlet path and path info?

549


What’s the difference between sendredirect and forward methods

568


What is the difference between Servlets and Applets?

549


Describe in brief RequestDespatcher?

596


Is servlet a controller?

575