• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Calling a Servlet from an Applet

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can I pass things (parameters,strings,...) from an applet to a Servlet?.
I'm connected from the Applet to the Servlet with its URL.I get URL's OutputStream and send a string.
In the Servlet I'm trying to read the sended string with the ReadLine() method but the servlet don't run good. It waits for something to read that never arrives.
Thanks.
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is an example of an applet calling a servlet by passing it an object and then getting an object back from the servlet. The rule is the objects passed back and forth must be serializable. So you could pass a String containing a SQL statement from the applet to the servlet and get back a Vector (not a ResultSet which isn't serializable) from the servlet.
This example is very simple. All the applet does is pass an object to the servlet which adds 10 to an int inside the object and then passes the object back again.
Here is the class passed back and forth:

Here is the applet.

Here is the servlet:


[This message has been edited by Thomas Paul (edited February 28, 2001).]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic