Combining Java and CGI Scripts
Communicating Between Client and Server
By Bill Pierce
Early Web pages were able to offer interactivity only by running CGI scripts on the server. The advent of Java in 1995 provided a way to create intelligence on the client side; since then, a great deal of effort has been expended to allow Java client-side programs to communicate with gateways and backend databases. However, access to a server database engine isn't always enough. Sometimes you need to access other computing resources: to read or write files, list directories, or run models on the server. One way to do this is to create a Java-CGI hybrid application -- a Java applet or application that can run select CGI routines to interface with the server services.
I work with a group of physical oceanographers who all need access to configure and run a suite of signal-processing codes on a Sun Ultra. Because this suite evolved in a number of academic institutions over ten years, the inputs to the codes were quite complex and interdependent, and the leader of our group wanted to create a graphical user interface that would make configuration easier, check the inputs for consistency, and run on both NT and UNIX workstations. Combining a Java GUI on the front end with CGI on the back end would give users on these different platforms GUI control over the input files and codes on the server.
Client Side versus Server Side
Should intelligence lie on the client side or on the server side? Well, tasks like validating a form field or manipulating a graphical object with the mouse clearly belong on the client side; you needn't burden the server with each keystroke and mouse click.