I have an applet that need to communicate with a servlet. I know how to update a single text field in the applet from data returned by the servlet. I also know how to create an html table from the servlet that can be displayed alongside the applet panel. My question: how do i update multiple text fields in the applet from data returned by the call to the servlet?
Presumably, you just send some marked-up data from the servlet, and let the Applet split it into the appropriate fields. I find that the simplest way to do this is to use the built in "Properties" class. Build a Properties object on the server (it's like a Hashtable, so just use put(name, value)), then use it's 'save' (or 'store' in Java2) method to write itself out to the output stream. In the Applet, create a new Properties object and use 'load' to parse the incoming stream, then set the applet fields from the Properties data. Is this what you are looking for?
Thanks Frank, you make it sound so easy, ahh the joy of se.. I mean Java, let me give that a try. Also can you recommend any good books on Servlet programming? I just purchased Java Servlet Programming by Jason Hunter (published by O'Reilly) it seems pretty good.
Joined: Jan 07, 1999
Paul has reviewed several Servlet books in the "bunkhouse". Yes, there is a web site outside this board .... Personally, I use Hunter, if anything, but (unless you have a new edition) it's not quite up to date with some of the latest APIs.