O'Reilly logo

Tomcat: The Definitive Guide by Ian F. Darwin, Jason Brittain

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix B. JSPs and Servlets

This appendix is meant to be a kind of bridge from your skills as a system administrator, which probably include a familiarity with a variety of scripting languages, to give you some familiarity with the Java development side of Tomcat. Since Tomcat specializes in running servlets and JSPs, we discuss what these are in a bit more detail. First, though, we review a variety of network software architectures, so you have a better idea of where servlets and JSPs fit into the big picture of network software development.

Here are four general Java-centric approaches to networked application development. Since almost all web applications need access to a backend database, we also say a few words about how the Java code accesses the database.

Web application displays an applet, and the applet uses JDBC to connect to a database

—Slow; browser incompatibilities

Download application using Java Web Start; application uses JDBC

—Avoids browser problem; performance can be slow due to lack of caching

Web application sends pure HTML and uses servlets and JSPs

—Servlets use JDBC; JSPs, if necessary, use the Java Standard Template Library (JSTL)

—Closest to use of mod_perl, PHP, or CGI

—Good general approach

Web application uses servlets, and servlets use EJBs to access database

—Claimed to be a good “enterprise"-scale approach (J2EE-style)

Briefly, a servlet is a Java program designed to run in a servlet container (we hope you didn’t catch that circular definition), and a JSP ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required