1. Static Document Server Model
The first operational model had the Web server simply serving up documents on request. In this environment, the content doesn’t change unless a human author supplies a new version of a document.
2. Dynamic content generated by a CGI script
A CGI program is invoked by the Web server in response to certain types of requests, usually requests for documents in a particular directory or filenames having a particular extension, such as .cgi. The request parameters are passed as key/value pairs and the request headers as environment variables. The program reads these parameters and headers, performs the application task at hand (typically accessing a database to do so), and then generates an HTTP response. The response is sent back to the requesting Web browser as if it were an ordinary static document.
CGI is convenient, but it has one big drawback. Ordinarily, CGI spawns a new process for each HTTP request. This isn’t a problem when traffic is low, but it creates a great deal of overhead when the traffic level increases. This being the case, CGI in general doesn’t scale well.
3. Dynamic applications using servlets, JSP, and J2EE
A significant improvement came with the release in 1997 of the Java Servlet API, followed quickly by the JavaServer Pages (JSP) API. These related technologies bring the full power of Java to the Web server, with database connectivity, network access, and multithreaded operations, and, notably, a different process model. Servlets and JSP pages operate from a single instance that remains in memory and uses multiple threads to service requests simultaneously. Servlets and JSP pages can make use of the full Java 2 Enterprise Edition (J2EE) environment for sophisticated, robust applications.
Source :- JSP: The Complete Reference By Phil Hanna