Installing the Book Examples

All JSP pages, HTML pages, Java source code, and class files for the book examples can be downloaded directly from the O’Reilly web site:

http://www.oreilly.com/catalog/jserverpages/

They can also be downloaded from the book web site:

http://www.TheJSPBook.com

The file that contains all the examples is called jspbook.zip. Save the file on your hard drive, for instance in C:\JSPBook on a Windows platform, and unpack it:

C:\JSPBook>jar xvf jspbook.zip

You can use the same command on a Unix platform.

Two new directories are created: ora and src. The first directory contains all examples described in this book, and the second contains the Java source files for the JavaBeans, custom actions, and utility classes used in the examples.

The examples’ directory structure complies to the standard Java web application format described in Chapter 2. You can therefore configure any Servlet 2.2-compliant web container to run the examples. If you like to use a container other than Tomcat, be sure to read the documentation for that container.

To install the example application for Tomcat, copy the web application directory structure to Tomcat’s default directory for applications, called webapps. Use this command on a Windows platform:

C:\JSPBook>xcopy /s /i ora %TOMCAT_HOME%\webapps\ora

On a Unix platform it looks like this:

[hans@gefion /usr/local/jspbook]cp -R ora $TOMCAT_HOME/webapps

Recall from Chapter 2 that each web application in a server is associated with a unique URI prefix. When you install an application in Tomcat’s webapps directory, the subdirectory name is automatically assigned as the URI prefix for the application ( /ora in this case).

At this point, you must shut down and restart the Tomcat server. After that, you can point your browser to the ora application with the following URL:

http://localhost:8080/ora/

You should see a start page, as in Figure 4.3, that contains links for all examples in this book.

JSP book examples start page

Figure 4-3. JSP book examples start page

Get Java Server Pages now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.