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
Can you send an authentication error from a servlet?
Differentiate between get and post?
What is a servlet context?
What are the advantages of servlets over traditional cgi?
How can the referrer and the target urls be used in servlet?
How can we create deadlock situation in servlet?
What do you understand by mime type?
What are the different mode that servlets can be used?
Who is responsible for writing a constructor?
How can I send user authentication information while making URL Connection?
Is servlet a framework?
How to commuincate between an applet and a servlet?
Which java framework is most popular?
Define context initialization parameters.
Explain the difference between servlet and cgi?