Simple complete demo of an applet writing to and reading from a server file

Hi everyone,

I am looking for a simple, complete code demonstration of an applet that writes to and reads from a file located on the server (same server/directory the applet is on).

My goal: to have an applet with 2 text boxes and 2 buttons. I enter in text in the text box and push the button and it saves that text to a .dat file on the server. Also, the otehr button reads the file and displays the text in the file to the text box on the applet.

I have looked and searched through this forum and I can't seem to find any complete examples of this code.

Thanks

[596 byte] By [dswetta] at [2007-11-26 12:21:08]
# 1
http://www.frank-buss.de/echoservlet/
sabre150a at 2007-7-7 15:12:19 > top of Java-index,Archived Forums,Socket Programming...
# 2
ok, do I have to use a servlet to accomplish this? Will this save the file to a .dat file on my server or does it just echo?
dswetta at 2007-7-7 15:12:19 > top of Java-index,Archived Forums,Socket Programming...
# 3

> ok, do I have to use a servlet to accomplish this?

> Will this save the file to a .dat file on my server

> or does it just echo?

You will need some form of server. You can roll your own, use an FTP server, use an Servlet engine such as Tomcat or some other server. It is up to you.

The example was meant to show you how to deal with the difficult part i.e. the communication with the servlet. If you have been though the Java tutorial section on Input and Output the rest should be easy.

sabre150a at 2007-7-7 15:12:19 > top of Java-index,Archived Forums,Socket Programming...
# 4
I will try to use my ftp server then. Any instructions/examples specific to ftp?
dswetta at 2007-7-7 15:12:19 > top of Java-index,Archived Forums,Socket Programming...
# 5
> I will try to use my ftp server then. Any> instructions/examples specific to ftp?Google for Jakarta commons net. It contains a Java FTP client API you can use.You will need to configure your FTP server to allow writes to the desired directory.
sabre150a at 2007-7-7 15:12:19 > top of Java-index,Archived Forums,Socket Programming...