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
Is it good idea to create servlet constructor?
What is servlet container. how it works?
How we can create war file in servlet?
How can we upload the file to the server using servlet?
What is httpservlet class?
What is the difference between Servlets and Applets?
What is java servlet session?
Why are servlets used?
Explain jsessionid and when is it created?
What is a cookie What is the difference between session and cookie
How would you create deadlock on your servlet?
What is the difference between servlet and jsp?
What are the types of protocols supported by httpservlet ?
What is the procedure of invoking different servlet in a different application?
What is the difference between the include() and forward() methods?