i am developing an application whichi will run on client-server basis.as the clients run the application which is an applet,on the server side i want to keep a log of all transactions. so through applet how to create a file on server side. i am using ibm logging toolkit for logging facility thanks in advance
Applets are just program code that run on the client. You can of course instruct the applet to retrieve other objects from the same server (data files or images, for example), but there's no stateful "applet connection" between client and server, and no file upload capability. To do what you want, you need ftp, or a servlet that handles uploads, or some supplemental technique. You can of course integrate this into your applet, but the applet class itself does not directly support what you want to do. ------------------ Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
Make visible what, without you, might perhaps never have been seen. - Robert Bresson
You can make an applet write a file to a server if the applet opens a URLConnection to a server application (for example, a servlet) and writes the date through the connection. The server application is responsible for storing the data it receives. However, you were interested in logging, you said. For basic info, this is done automatically into the server's access and/or error logs. If you need to capture more info -- such as data transferred in a POST operation -- you'll need to code that in the server app. None of that requires any client-side action. Nor should it. Clients can be hacked much easier than servers can, so it's wise to trust them no more than necessary.
Customer surveys are for companies who didn't pay proper attention to begin with.
I assume one would use the getOutputStream method of the URLConnection. Does this perform a post? If so, how do you know what property of the post contains the file data? If no, what code would you need to write on the servlet side to accept the output stream?
HttpURLConnection can do a GET or a POST. The returned output stream is the actual data transmitted - that is, if your request resulted in an HTML response, you'd get back exactly the same data as a web browser would. The HttpURLConnection facility also has the ability to retrieve the response's associated headers, cookies, etc. I don't do this often enough to have the details committed to memory, so I'd have to RTFM to give specifics, but the information's well enough documented. [ March 21, 2003: Message edited by: Tim Holloway ]