This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
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).]