JSP Tag Libraries

Скачать в pdf «JSP Tag Libraries»

identical servlet which takes HTTP requests on its behalf. Since JSP custom tags are actually part of JSP technology, we’ll place more emphasis on JSP topics. JSP is, however, based on the servlet infrastructure and, as such, requires some understanding of servlets as well.

2.2 Introduction to Java servlets

Servlets are Java components whose role is to extend web servers, enabling them to return dynamic content, instead of just static files. A common comparison describes servlets as the server-side version of applets. Whereas applets are small bits of Java code that execute on a web client, servlets are bits of Java code (not necessarily small) that execute on a web server. These servlets are handed an incoming HTTP request (including any parameters, headers, cookies, etc.) which they then process and, ultimately, return a response to the user. Servlets started out as the extension API of JavaWebServer, a Java-based web server product from JavaSoft. The only remains of JavaWebServer are servlets, which became the first successful and widespread server-side Java API.

There are many reasons for the success of servlets: ease of use, ease of development, and the maturity of the Java language. The most important feature is that servlets can extend practically any web server on virtually all operating systems. This means that using a servlet does not tie you into a specific vendor, unlike many of the techniques we saw in chapter
1. Servlet-based applications developed on IIS and NT can later be deployed on Linux and Apache, and vice versa.

The next few sections will present the servlet API and programming model, and will also discuss how servlets and web servers interact.

Скачать в pdf «JSP Tag Libraries»