Chapter 3. Java Servlets
Over the last few years, Java has become the predominant language for server-side programming. This is due in no small part to the Java Servlet API , which provides a standard way to extend web servers to support dynamic content generation. In terms of enterprise computing, servlets are a natural fit if you are using the Web as your deployment platform. You can take advantage of web browsers as universally available thin clients using the web server as middleware for running application logic. Under this model, the user makes a request of the web server, the server invokes a servlet designed to handle the request, the servlet fulfills the request, and the result is returned to the user for display in the web browser.
While this sounds like every other dynamic content technology (such as CGI, ISAPI, ASP, PHP, and the like), servlets have some major advantages. For one, servlets are persistent between invocations, which dramatically improves performance relative to CGI-style programs. Servlets are also 100% portable across operating systems and servers, unlike any of the alternatives. Finally, servlets have access to all the APIs of the Java platform, so, for example, it is easy to create a servlet that interacts with a database, using the JDBC API (see Chapter 8).
The Servlet API also provides the basis for programming with JavaServer Pages (see Chapter 4), Struts (see Chapter 19), and Java Server Faces (see Chapter 5). In fact, if you use one of these frameworks ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access