18.3 Installing and Running the Example Struts-Faces Application

In an effort to prove that JSF and Struts could work together, Craig McClanahan developed an integration library for Struts and JSF. Currently, there is code within the contrib folder of the Struts source download that provides early access to what the integration between Struts and JSF will look like. It's incomplete and probably not ready for production applications, but it's worthwhile to take a look so that you can see and understand what might be coming in future releases of Struts.

At the time of this writing, the version of the struts-faces library that ships with the 1.1 source download was based on the EA4 release of JSF. It's not compatible with the final release of the JSF API, which has recently occurred. This should be fixed in a future release of Struts. In the meantime you can find a version that works with the final JSF release at http://cvs.apache.org/builds/jakarta-struts/nightly/struts-faces.

After downloading the struts-faces library, unzip the contents. The download contains a readme.txt file that discusses many important issues and discusses how to install the library. There are two example JSF/Struts applications included; one with Tiles and one without. You can choose to build from the source or just utilize the WAR files that are included. However, even with the WAR files, you must perform some additional steps. These extra steps are necessary due to the beta nature of the JSF reference implementation and a license preventing JSF from being redistributed in an application until the implementation is final. When the reference implementation is made final (this should happen soon), the restrictions will be lifted and the struts-faces library will fall under the standard Sun licensing rules.

The extra steps necessary to run the application are as follows:

  1. Extract the struts-faces.war file (located in the struts-faces/webapps) directory into a temp directory.

  2. Download the JSF reference implementation from http://java.sun.com/j2ee/javaserverfaces and extract it.

  3. Copy the jsf-api.jar and jsf-impl.jar JAR files from the JSF reference implementation to the WEB-INF/lib of the temporary directory (where you expanded struts-faces.war).

  4. JAR this "new" web application using the command jar cvf ../struts-faces.war * .

After you perform the extra steps, deploy the newly created struts-faces.war (which now should contain the two JSF JARs) into your favorite container, such as Tomcat. You can run the example application using the URL http://localhost:8080/struts-faces.

Programming Jakarta Struts
Programming Jakarta Struts, 2nd Edition
ISBN: 0596006519
EAN: 2147483647
Year: 2003
Pages: 180

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net