This How-To provides guidance on how to set up your own ANT based environment in order to compile and run the code samples from the book.
For JSF 1.0/1.1 a set of jar files must be added to your Web application in order for it to run Faces applications. This contrasts with JSF 1.2 where the container has all of the necessary jar/classes for running JSF.
The provided ANT sample build.xml and its associated build.properties file have references to the required jar files for JSF. These are:
|
# Jars for JCP Standards servlet.jar= Local path to servlet-api.jar # Jars for implementations of JCP standards standard.jar=Local path to standard.jar # Jars for miscellaneous dependencies required by Sun's JSF 1.1 commons-beanutils.jar=Local path to commons-beanutils.jar |
Obtaining the necessary jar files is easily done by downloading from three general areas:
1. J2EE Container such as Tomcat
Tomcat will contain the both servlet-api.jar and jsp-api.jar in its common/lib directory.
http://tomcat.apache.org/download-55.cgi (Download link for Tomcat 5.x)
2. JSF API and implementation jar files: jsf-api.jar, jsf-impl.jar
From Sun:
http://java.sun.com/javaee/javaserverfaces/download.html
(Alternatively) From MyFaces:
http://myfaces.apache.org/download.html
3. Jakarta Commons libraries: commons-beanutils.jar, commons-collections.jar, commons-digester.jar, commons-logging.jar.
These are bundled in the reference implementations, but can also be downloaded separately:
http://jakarta.apache.org/commons/
4. Jakarta Standard 1.1 Taglib: jstl.jar, standard.jar.
http://jakarta.apache.org/site/downloads/downloads_taglibs-standard.cgi
Once downloaded, you can then reference in your properties file. Here is an example build.properties file with references to the jar files.
|
# Jars for JCP Standards servlet.jar=C:/Program Files/Apache/Tomcat 5.5.7/common/lib/servlet-api.jar # Jars for implementations of JCP standards standard.jar=C:/jakarta-libs/standard.jar # Jars for miscellaneous dependencies required by Sun's JSF 1.1 commons-beanutils.jar=C:/jakarta-libs/commons-beanutils.jar |
The book used ANT version 1.6.5.
In the directory where the build.xml files are located for each chapter's examples, type "ant" at the command line to create the deployable WAR files in a /build subdirectory. The generated WAR file can then be deployed to any standard J2EE container (Tomcat, OC4J, Weblogic, Sun Appsvr, and so on)
To clean out the generated /build subdirectory run "ant clean".
Finally, its important to remember that if you use a JSF enabled IDE such as the ones listed in Chapter 17, you don't have to manually download each set of Jar files!
Contact Information | For general questions: jsfcomprefinfo | For errata: jsfcompreferrata