That's wierd .... i simulated the same thing on the said platform and it works
fine .... so i guess the only explaination is NT4.0 :-)
How about testing the same thing on some other platform ... ?!
Rishi.
Sandeep Gupta wrote:
> I've checked that the string sent to applet is not null.
>
> There is no specific reasoon to set content type in that way. I just copied
> it from a tutorial. Please let me know if there is a possibility of a
> problem there ?
>
> Thanks & Regards,
> Sandeep.
>
> > -----Original Message-----
> > From: Francesca Quattrocchi [SMTP:[EMAIL PROTECTED]]
> > Sent: Tuesday, January 11, 2000 4:54 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Unable to get results from Servlet
> >
> > Are you sure you don't send a null String to the applet?
> > Just another question: why do you set the Content Type in that way?
> >
> > > -----Original Message-----
> > > From: Sandeep Gupta [SMTP:[EMAIL PROTECTED]]
> > > Sent: Tuesday, January 11, 2000 4:04 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Unable to get results from Servlet
> > > Importance: High
> > >
> > > Hi All,
> > >
> > > I need to do Applet-Servlet Communication. I'm able to communication
> > from
> > > Applet to Servlet but not vice-versa. While I try to get results from
> > > Servlet it gives following exception:
> > >
> > > java.io.StreamCorruptedException: InputStream does not contain a
> > > serialized
> > > object
> > >
> > > I'm working with JDK1.1.8 on NT4.0. My appletside code is :
> > >
> > > URLConnection con = servlet.openConnection();
> > > con.setDoInput(true);
> > > con.setDoOutput(true);
> > > con.setUseCaches(false);
> > > con.setRequestProperty("Content-Type",
> > > "application/x-www-form-urlencoded");
> > >
> > > // Write the arguments as post data
> > > ObjectOutputStream out = new
> > > ObjectOutputStream(con.getOutputStream());
> > > int numObjects = objs.length;
> > > for (int x = 0; x < numObjects; x++) {
> > > out.writeObject(objs[x]);
> > > }
> > >
> > > out.flush();
> > > out.close();
> > >
> > > ObjectInputStream in=new ObjectInputStream(
> > > con.getInputStream());
> > >
> > > And my Servlet code is:
> > > public void doPost(HttpServletRequest req, HttpServletResponse resp)
> > > throws ServletException, IOException
> > > {
> > > ObjectInputStream in = new
> > > ObjectInputStream(req.getInputStream());
> > > ObjectOutputStream out = new
> > > ObjectOutputStream(resp.getOutputStream());
> > > try {
> > > String data1 = (String)in.readObject();
> > > String data2 = (String)in.readObject();
> > > String result = db.Login(data1,data2);
> > > Serializable objs1[] = {result};
> > > out.writeObject(objs1[0]);
> > > out.flush();
> > > out.close();
> > > in.close();
> > > } catch (Exception e) {
> > > System.out.println("Exception in UserLogin Servlet: "+e);
> > > }
> > > }
> > >
> > > Please let me know, where am I wrong ?
> > >
> > > Thanks & Regards,
> > > Sandeep.
> > >
> > >
> > __________________________________________________________________________
> > > _
> > > 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
begin:vcard
n:Asthana;Rishi
tel;fax:1-732-548-4009
tel;home:1-732-635-3597
tel;work:1-732-548-0087
x-mozilla-html:FALSE
org:NetCom Systems, Inc;Software Development
adr:;;116,Copperfield Ln ;Metuchen;NJ;08840;USA
version:2.1
email;internet:[EMAIL PROTECTED]
title:Systems Consultant
x-mozilla-cpt:;-3936
fn:Rishi Asthana
end:vcard