• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet to servlet communication Netscape

 
venkat thota
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,

Can anybody help me in this problem.. Iam able to establish connetion and pass data from applet to servlet in IE. But if i run the same program in netscape im not able to call the servlet.
AppletContext ac = this.getAppletContext();
URL dataServlet = new URL(this.getCodeBase(),"/servlet/Data?timer="+timer+");
URLConnection servletConnection = dataServlet.openConnection();
System.out.println("Save ServletConnection :"+servletConnection);
servletConnection.setUseCaches(false);
servletConnection.setDefaultUseCaches(false);
servletConnection.setDoInput(true);
servletConnection.setDoOutput(true);
servletConnection.setRequestProperty ("Content-Type", "application/octet-stream");
ObjectOutputStream oos = new ObjectOutputStream(servletConnection.getOutputStream());
System.out.println("Save output stream :"+oos);
oos.writeObject(vb);
System.out.println("Save Object written");
oos.flush();
oos.close();

Here in java console of Netscape its displaying all the three System.out.println() Statements.
System.out.println-- 1: Save ServletConnection :"Exact path"
System.out.println-- 2: Save output stream :"connetion object"
System.out.println-- 3: Save Object written

But its not actually calling servlet.Actually i have written system.out.println() in servlet which is not displaying.. But in IE all this is working well.Could u please anybody help me in this case.Thanx in advance.
venkat thota
 
Tim Holloway
Saloon Keeper
Posts: 18359
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might want to check the status code returned from the URL write. Also look at the server logs to see what the actual URI was (and/or println the value of dataServlet.toString()
 
venkat thota
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi tim,
yes ur correct . just print it and cheque what i feel is the is problem while creating URL itself in ur program that's why its giving file not found error ..
venkat
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic