Why don't u try adding some data to the hashtable and
try reading that from the applet ??

--- puppala sreenivas <[EMAIL PROTECTED]> wrote:
> Hi,
> Here is my code snippet:
>
> Servlet:
>
> public void doGet(HttpServletRequest req,
> HttpServletResponse res) throws
> ServletException, IOException{
>
>    Hashtable mainHT = new Hashtable();
>    mainHT = processSelect();
>
>    res.setContentType("application/octet-stream");
>   ObjectOutputStream outputToApplet = new
>   ObjectOutputStream(res.getOutputStream());
>
>   outputToApplet.writeObject(mainHT);
>   outputToApplet.flush();
>   //outputToApplet.close();
> }
>
>
> Applet:
>
>
> public Object receiveObject(String servletName)
> {
>    try
>    {
>      String urlString =
> getDocumentBase().toString();
>
>      urlString = urlString.substring(0,
> urlString.lastIndexOf("/")+1)+
>
> "servlet/"+servletName;
>
>      URL servletURL = new URL(urlString);
>      URLConnection servletConnection =
> servletURL.openConnection();
>      servletConnection.setDoInput(true);
>      servletConnection.setDoOutput(false);
>      servletConnection.setUseCaches(false);
>      servletConnection.setRequestProperty("Content-
> Type",
> "application/octet-stream");
>
>      ObjectInputStream inputStmFromServlet =
>            new
>
ObjectInputStream(servletConnection.getInputStream());
>      Object receivedObj =
> inputStmFromServlet.readObject();
>      inputStmFromServlet.close();
>      return receivedObj;
>    }
>    catch(IOException ioe)
>    {
>     System.out.println("Exception ioe");
>     System.out.println(ioe);
>     ioe.printStackTrace();
>     return null;
>    }
>    catch(Exception e)
>    {
>      e.printStackTrace();
>      return null;
>    }
>
> }
>
> Hope with this some one can throw some light on the
> problem.
> I am having all the class files of applet in the
> public_html directory and
> servlet's class file is in servlets directory of the
> web server.
>
> TIA
> S
>
>
>
>
> >From: Danny Rubis <[EMAIL PROTECTED]>
> >Reply-To: "A mailing list for discussion about Sun
> Microsystem's Java
> >        Servlet API Technology."
> <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >Subject: Re: IOException in Applet-Servlet
> Communication
> >Date: Mon, 18 Dec 2000 19:10:08 -0500
> >
> >Hey!
> >
> >Send the list a small sniplette of you code where
> you are
> >doing the IO.  How can we tell otherwise?
> >
> >Sans adieu,
> >Danny Rubis
> >
> >puppala sreenivas wrote:
> >
> > > Hello All,
> > >
> > > I am having the applet-servlet communication in
> my project and in the
> > > initial testing it self I am getting this
> exception in Netscape's java
> > > console
> > >
> > > java.io.IOException: The document contained no
> data.
> > > Try again later, or contact the server's
> administrator.
> > >
> > >   at netscape.net.URLConnection.connect(Compiled
> Code)
> > >
> > > * at
> netscape.net.URLConnection.getInputStream(Compiled
> Code)
> > >
> > >   at CheckListApp.receiveObject(Compiled Code)
> > >
> > >   at CheckListApp.loadInitialData(Compiled Code)
> > >
> > >   at CheckListApp.jbInit(Compiled Code)
> > >
> > >   at CheckListApp.init(Compiled Code)
> > >
> > >   at
>
>netscape.applet.DerivedAppletFrame$InitAppletEvent.dispatch(Compiled
> > > Code)
> > >
> > >   at
>
java.awt.EventDispatchThread$EventPump.dispatchEvents(Compiled
> >Code)
> > >
> > >   at java.awt.EventDispatchThread.run(Compiled
> Code)
> > >
> > >   at
> > >
>
>netscape.applet.DerivedAppletFrame$AppletEventDispatchThread.run(Compiled
> > > Code)
> > >
> > > Can anybody giude me on this? I am able to see
> the hello world servlet
> >in
> > > the servlets directory of my web server.Here it
> self is my servlet's
> >class
> > > file.
> > > TIA
> > > S
> > >
>
>_________________________________________________________________________
> > > Get Your Private, Free E-mail from MSN Hotmail
> at
> >http://www.hotmail.com.
> > >
> > >
>
>___________________________________________________________________________
> > > 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
>
>
_________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at
> http://www.hotmail.com.
>
>
___________________________________________________________________________
> 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
>
=== message truncated ===


__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/

___________________________________________________________________________
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