Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Applet to servlet communication Netscape

 
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
 
Saloon Keeper
Posts: 22122
151
Android Eclipse IDE Tomcat Server Redhat Java 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
 
"I know this defies the law of gravity... but I never studied law." -B. Bunny Defiant tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic