• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

passing object between applet and servlet

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Applet on Apache web server sends the object with some parameters to servlet,then servlet supported by tomcat passes back the object with changed parameters. The interesting is: in applet side, it is not working if I sending/getting object can not be put in two try{}(see the attached list 1). It is working when I put then in one try{}(see the attached list 2). Don't why?

List 1:

List 2


--Added code tags and formatted for easy reading- Carl
[ June 09, 2004: Message edited by: Carl Trusiak ]
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gee, in Listing 1, you have TWO URLConnections, one you write the object to and the other (Which by the way has NOTHING to do with the first) you are trying to read an Object off of. You can do this in 2 try blocks but, you need to use the same connection objecct in both:
List 3

There really is no reason to split these out like this. What will happen, if you get an exception in the first block, you will also get an exception in the second.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also NEVER close the connection after sending to the servlet, just flush() the stream. Calling toServlet.close(); will close the whole connection so don't do it until the response has been received.
Bill
 
may Lee
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks very much!
 
It is no measure of health to be well adjusted to a profoundly sick society. -Krishnamurti Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic