1.1 Java Servlet and its characteristics servlet are Java technology to answer CGI programming. The servlet program runs in the server side, dynamically generates a web page. Compared to traditional CGIs and many other similar CGI technologies, Java servlets have higher efficiency, easier to use, more powerful, better portability, saving more investment (more important, servlet programmers The income is higher than the Perl programmer :-): Efficient. In the traditional CGI, each request will start a new process. If the CGI program itself has a short period of execution, the overhead required to start the process is likely to exceed the actual execution time. In the servlet, each request is processed by a lightweight Java thread (not the heavyweight operating system process). In the traditional CGI, if there is a request to the same CGI program, the code of the CGI program is repeated in memory in memory; for servlet, the request is N thread, only one servlet Class code. In terms of performance optimization, servlets have more choices than CGI, such as buffering previous calculations, maintaining the activity of the database connection, and so on. Convenience. Servlet provides a large number of utility routines, such as automatically parsing and decoding HTML form data, reading, and setting up HTTP headers, processing cookies, tracking session status, etc. Powerful. In servlet, many tasks that use traditional CGI programs are easy to complete. For example, servlets can interact directly with the web server, while ordinary CGI programs cannot. Servlets are also capable of sharing data between individual programs, making it easy to implement the functions such as database connection pools. It is good to be portable. Servlet is written in Java, servlet API has a perfect standard. Therefore, servlet written for I-Planet Enterprise Server can be ported to Apache, Microsoft IIS or WebStar without any substantial changes. Almost all mainstream servers support the servlet directly or through the plugin. Save investment. Not only is there many cheap or even free web servers available for personal or small-scale websites, but also for existing servers, if it doesn't support servlet, add this part of the function is often free (or only very small investment). 1.2 JSP and its Features JavaServer Pages (JSP) are a technique that implements normal static HTML and dynamic HTML mixed encoding. For details on the JSP basic concept, see "JSP Technical Introduction". Many of the pages generated by the CGI program are still still static HTML, and the dynamic content appears only in several parts of the page. However, most CGI technology, including servlets and variants, always generates the entire page via the program. JSP makes we can create these two parts, respectively.