|< Day Day Up >|
3.4 Installing the Book Examples
All JSP pages, HTML pages, Java source code, and class files for the examples can be downloaded from the O'Reilly site at http://www.oreilly.com/catalog/jsvrfaces/.
They can also be downloaded from my personal web site, where you also find articles, tips, and other resources:
On this site, you'll find a Download page where you can download the examples distribution file, called jsfexamples.zip. Save the file on your hard drive (for instance, in C:\JSFBook on a Windows platform) and unpack it:
C:\JSFBook> jar xvf jsfexamples.zip
You can use the same command on a Unix platform.
Two new directories are created: jsfbook and src. The first directory contains all examples described in this book, and the second contains the Java source files for the JavaBeans, custom components, and other classes used in the examples.
The examples directory structure complies with the standard Java web application format described in Chapter 4. You can therefore install the examples in any JSP 2.0-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 for instructions on how to install a web application.
To install the example application for Tomcat, simply copy the web application directory structure (the jsfbook directory) to Tomcat's default directory for applications, called webapps. On a Windows platform, you can copy/paste the directory structure with the Windows Explorer tool, or use this command in a Command Prompt window:
C:\JSFBook> xcopy /s /i jsfbook %CATALINA_HOME%\webapps\jsfbook
On a Unix platform it looks like this:
[hans@gefion jsfbook] cp -R jsfbook $CATALINA_HOME/webapps
As you'll learn more about in Chapter 4, each web application in a server is associated with a unique URI prefix (the context path). When you install an application in Tomcat's webapps directory, the subdirectory name is assigned automatically as the URI prefix for the application (/jsfbook, in this case).
To run the examples, you must also define a couple of usernames. If you use the Tomcat server, edit the CATALINA_HOME/conf/tomcat-users.xml file and add these lines somewhere within the <tomcat-users> element (this process is described in more detail in Chapter 4):
<tomcat-users> <role rolename="manager" /> <role rolename="employee" /> ... <user username="mike" password="boss" roles="manager" /> <user username="hans" password="secret" roles="employee" /> ... </tomcat-users>
At this point, you must shut down and restart the Tomcat server. After that, you can point your browser to the jsfbook application with the following URL:
You should see a start page, as in Figure 3-2, that contains links to all examples in this book.
|< Day Day Up >|