|
Answer» Servlets have a variety of WAYS to realize access to information. For the bulk of it, every method returns a specific result. Compared with CGI programs its information by making use of passed environment variables, ONE can see multiple advantages by using the servlet approach. - Stronger type checking:
Stronger type checking MEANS that there is more support in the compiler for finding errors in syntax and types. A CGI program utilizes one function to get its environment variables, and several errors are not caught at compile-time and they get only know at runtime cannot be caught until some runtime issue got caused. - Delayed calculation:
The value for every environment variable has to be precalculated and passed when a server starts a CGI program, even if the program uses it or not. In contrast, servlets launched by servers can enhance the performance on the fly by delaying calculation and do calculations when that PIECE of code is actually used. - Interactives with the server:
A CGI program is free from its server, once the execution BEGINS. Then, the single communication path that the program uses is its standard output. However, a servlet can work with the server. A servlet works in 2 ways: either in the server or as a connected sidecar process outside the server.
|