skip to main content

Programming Guides : Servlets & CGI : Introduction : Servlets Replace CGI Programs

Servlets Replace CGI Programs
Servlet technology was developed to improve upon and replace CGI programs. Servlet technology is superior to CGI but uses the same HTML code. So you can switch from CGI programs to servlets on the back-end without having to change the programming on the front-end. Servlets use the CGI protocol.
In addition to Java technology's platform independence and promise of write once, run anywhere, servlets have other advantages over CGI programs:
One of the most remarkable differences between servlets and CGI programs is that Web servers automatically maintain user session state for servlets. This means that the servlet can store user-session specific information in a user session object and retrieve that information on a subsequent call. The isCOBOL Runtime Framework uses this feature to associate the user session with a COBOL thread context. This makes sure that the same instances of COBOL programs get used each time they are called during a particular user session. In other words, COBOL programs called during a particular user session retain their file states and working-storage data between requests from that user session. If desired, the programmer can cancel the program at any time with the CANCEL statement. In fact, at first it will be necessary to cancel old CGI programs because they were written to assume that they have been cancelled between calls. Later, the CANCEL statement can be removed as the old CGI programs are updated to make use of the stateful nature of servlets.

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left