A Client-Side Save Method in Java
By Carl Dreher
A Java applet cannot write to the client's disk, right? Wrong -- it actually can, using a completely client-side Java applet.
The necessity for this invention began a few years ago when I wrote AXE, a business program that calculates the total cost of ownership for programmable logic chips. AXE has 46 different variables the user can set to accurately model development costs, from engineering salaries to the current interest rate on business loans. Naturally, once the user has set all these variables, they are saved to disk and needn't be reentered.
Recently, I rewrote AXE in Java so it could be moved to the Web. Christened WebAXE, the new program had to comply with Navigator and Internet Explorer, versions 3 and 4, and offer the same functions as the original program. That meant it had to be able to save the user's data; it also meant staying with Java 1.0.2 specs instead of 1.1.
A logical approach would be to write a client-side program in Java that sends the user's inputs to the server, and a server-side script that saves the data. However, this requires multiple client-server exchanges, which can be slow during heavy Web traffic and also consumes bandwidth. Furthermore, it consumes server CGI resources and is a maintenance headache for the system administrator.
More importantly, I'm not a server-side programmer. I had no idea how or where WebAXE would be deployed, and I wanted to debug it completely on my PC without involving a server. I needed a client-side "Save" method, and this article will tell you how I achieved it.<>