To round off our discussion of Java, especially those aspects of special interest to Oracle developers using Java on the Web, we’ll take a look at servlets, JavaServer Pages, and servlet runners in the following sections.
A Java servlet is nothing more than a Java program that sits on a web server delivering web content, doing much the same thing that a Perl CGI program might do. In fact, Java servlets are essentially just “Java CGI” programs. The name “servlet” itself is a sort of pun on “applet.” If it weren’t such a tongue-twister, applets might have been called “clientlets” (try saying that after a glass of Chardonnay).
Java servlets are becoming hugely important in the world of Oracle web applications, and in servlets Java has found itself a valuable niche, especially within the realm of the Apache JServ web server covered later in this chapter. Servlets have some advantages over traditional CGI scripting techniques, in particular:
Java servlets written on your Windows NT machine can be transferred later to your Solaris or Linux machines without any code changes.
For example, they don’t require the AWT (Abstract Windowing Toolkit).
These strengths include JDBC, multi-threadability, networking, and so on.
Servlets usually remain as object instances in memory until the web server is shut down. If they ...