What is the difference between CGI and Servlets?

What is the difference between CGI and Servlets?

CGI (Common Gateway Interface) is an attempt at providing users with dynamic content. It allows users to execute a program that resides in the server to process data and access database to produce the relevant data. They are written in the native operating system and then stored in a specific directory. 
A servlet is an implementation of Java that aims to provide the same service as CGI does, but instead of programs compiled in the native operating system, it compiles into the Java bytecode which is then run in the Java virtual machine. Though Java programs can be compiled into the native code, they still prefer to compile in the Java bytecode.

By:Sumit Tripathi
Date:2024-05-15 00:00:00

Post Your Answers

User Email:

User Name:

Related Java Subjective Links

Java Subjective interview questions and answers for experienced and fresher