Java programs can send a CGI request to a server, which is no different from an HTML form page. And like an HTML page, this request can be set to either get (download) or post (upload). In addition, Java programs can intercept the output of CGI programs, so there is no need to rely on programs to format a new page, or to force users to turn from one page to another when there is an error. In fact, the appearance of the program can be done with the previous version identical.
The code is simpler too, and it's not hard to write with CGI (if you really understand it). So in this section, we're going to do a crash course in CGI programming. To solve the general problem, some CGI tools will be created in C + + so we can write a CGI program that solves all the problems. The advantage of this is that the porting capability is particularly strong-the example that will be seen is running on any system that supports CGI, and there is no firewall problem.
This example also illustrates how to establish a connection between a program piece (applet) and a CGI program to easily adapt it to its own project.