I've created a crude Client/Server app using an Applet
for a client and and a servlet on the server side. The Applet
sends the servlet a User ID and Password, and the Servlet sends
back a String for the Applet to display.
here's the relavant applet code
String path = "http://www.mgardne.addr.com/servlets/GetUser?id=" +
ID.getText() + "&password=" +
passWord.getText();
URL servletURL = new URL(path);
BufferedReader reader = new BufferedReader
(new InputStreamReader(servletURL.openStream()));
StringBuffer result = new StringBuffer();
String line = null;
while ((line = reader.readLine()) != null)
{
result.append(line);
System.out.print(line);
}
The Servlet gets the name and password parameters, looks up
the user, and sends back a String describing that user.
the code looks something like
response.getWriter().println(getUser(ID,PassWord).toString())
However, I'd like to give the applet client more functionality by
allowing it to fiddle with the actual User Object. How do I get
a Servlet to send back a Java Object, and then How do I read it
in the client?
--Monte Glenn Gardner
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html