Why are servlets better than CGI programs written in languages such as Perl and C?
• Servlets are cross-platform: Because servlets are written in Java, they can be used on multiple platforms without worrying about compatibility issues or recompilation. In addition by using servlets, you are not tying yourself to a single vendor solution. • Servlets are fast: Standard CGI programs are slow because a new process must start up, run, and shutdown for every client request. For example: if a Perl cgi login program is being used by 25 users then the program has to be loaded into memory 25 times, executed, and shutdown- that’s a lot of overhead. Java servlets are fast because they are persistent. Our Website Login servlet loads only once and then services all 25 clients using multiple threads. It stays loaded in memory and waits for more requests and does not shut down for as long as the server is running. • Servlets are elegant: Because Java was created from the start to be object oriented, programs written in that language tend be organized more effectively into easily man