This is totally helpfull, tho I have one more question with respect to
it.. if my servlet has specific functions in it and for different
functions of my applet I want to call those different functions in the
servlet would I be able to do that? I see where you do the
outputData.writeObject(hash) to the servlet.. would I have to do that
instead of being able to call the servlets different functions and then
i'd have to have multiple servlets each only doing one task?


 On Tue, 15 May 2001, Raymond Cordero wrote:

> Here is some sample code all of it is not needed only I am passing the
> Servlets some values stored in a Hashtable. Of course wrap in the necessary
> try/catch clause
>
>             URL testServlet = new URL(codeBase,
> "/servlet/Item/GetItemList");
>
>             ObjectOutputStream outputData = null;
>
>             URLConnection servletConnection = testServlet.openConnection();
>             // inform the connection that we will send output and accept
> input
>             servletConnection.setDoInput(true);
>             servletConnection.setDoOutput(true);
>
>             // Don't use a cached version of URL connection.
>             servletConnection.setUseCaches(false);
>             servletConnection.setDefaultUseCaches(false);
>
>             // Specify the content type that we will send binary data
>             servletConnection.setRequestProperty("Content-Type",
> "application/octet-stream");
>
>             // send the object to the servlet using serialization
>             outputData = new
> ObjectOutputStream(servletConnection.getOutputStream());
>             outputData.writeObject(hash);
>
>             outputData.flush();
>             outputData.close();
>             ObjectInputStream inputStream = new
> ObjectInputStream(servletConnection.getInputStream());
>             tempVector = (Vector) inputStream.readObject();
>             inputStream.close();
>
> -----Original Message-----
> From: Sohaila Roberts [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 15, 2001 12:08 PM
> To: [EMAIL PROTECTED]
> Subject: Applets wanting to call a servlet from within
>
>
>  Hi, is it possible to call a servlet to do a certain function from within
>  the code of an applet? If so how exactly would it be set up..
>  Thanks
>
>  Sohaila
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to