Title: Re: Servlets with Applets
try this page... it has some links to servlet communication...
 
http://java.sun.com/docs/books/tutorial/servlets/index.html
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Branson, Don
Sent: Wednesday, July 21, 1999 9:32 AM
To: [EMAIL PROTECTED]
Subject: Re: Servlets with Applets


> Thanks for answering, do you have a code example, please

Cedric,

Nothing that I'm at liberty to share, unfortunately, but it's not too complicated.  Here are the basic steps:
 
On the applet side:
    Create a URL object which identifies the servlet's URL
    Use the URL object to get a URLConnection to the servlet
    Create an ObjectOutputStream which wraps the output stream from the connection
    Write your object(s) on the stream using writeObject(), then close the stream
    Create an ObjectInputStream to handle the response from the servlet
    Read the response object(s) from the servlet using readObject()
    Do something with the response
 
On the servlet side:
    In service(): create an ObjectInputStream and an ObjectOutputStream
    Read the object(s) from the input stream using readObject()
    Process the input
    Write the response object(s) to the output stream using writeObject()
    Close the streams
 
Don
 

Reply via email to