Chapter 9. Web Development
Java has arrived on the Web with a vengeance in the form of JavaServer Pages (JSP) and servlets, and we’ll take a look at how to create these using Eclipse in this chapter. To do that, we’re going to use the Tomcat web server, which is the Sun Microsystems reference implementation for both JSP and servlets—and it’s free for the downloading.
Even though we’re going to use Tomcat in this chapter, the Java code we write and the XML files we edit are not Tomcat-specific. JSP and servlets both must adhere to their respective specifications, which means you can use what we develop here with other JSP/servlet web containers.
Installing and Testing Tomcat
You can get the Tomcat web server at http://jakarta.apache.org/tomcat/; the current release version as of this writing is 4.1.29. Downloading and installing Tomcat isn’t hard—just unzip or untar it, which creates this directory structure:
jakarta-tomcat-4.1.29 |_ _bin Binary executable files |_ _common Classes available to internal classes and web apps | |_ _classes Common Java classes | |_ _endorsed Endorsed Java classes | |_ _lib Common Java classes in Java Archive (JAR) format |_ _conf Configuration files (such as passwords) |_ _logs The server's log files |_ _server Internal Tomcat classes |_ _shared Shared files |_ _temp Temporary files |_ _webapps Directory for Web applications |_ _work Scratch directory for holding temporary files
For web developers, the most important directory here is the webapps ...