,ch14.9433 Page 465 Monday, February 14, 2005 12:55 PM
There are two implementations of JSF available. The reference implementation (RI) has
been developed and is distributed by Sun. MyFaces, an open source Apache project,
implements the JSF specification and adds additional components not contained in the
reference implementation.
Struts Faces, initially developed by Craig McClanahan, allows you to use JSF tech
nology in a Struts application. Using this library, you can continue to use your
actions and action forms as written, but you use the JSF custom tags instead of the
Struts tags for the user interface. Struts Faces allows you to migrate your existing
Struts applications to JSF a page at a time.
This recipe will help you get started with Struts Faces. It applies this technology to a
three page application having an index page, a login page, and a welcome page dis
played upon login.
Struts Faces is under active development. For the latest documentation and code,
download the nightly build of Struts Faces from http://svn.apache.org/builds/struts/
nightly/struts faces/, extracting the archive into a directory on your system:
1. Copy the struts faces.jar and struts faces.tld from the struts faces/lib directory to
your WEB INF/lib directory.
2. Download and extract Sun's JSF reference implementation from http://java.sun.
com/jsf. At the time of this writing, Version 1.1 was the latest available.
3. Copy the jsf api.jar and jsf impl.jar from the jsf 1.1/lib directory to your WEB
INF/lib directory.
4. If your application doesn't use JSTL, copy the jstl.jar and standard.jar files from
the jakarta struts 1.2.x/lib directory to your WEB INF/lib directory.
5. Add the servlet declaration and mapping for the JavaServer Faces servlet to your
web.xml file. Set the load on startup value for the
FacesServlet
so it starts up
before the Struts
ActionServlet
:
faces
javax.faces.webapp.FacesServlet
1
action
org.apache.struts.action.ActionServlet
config
/WEB INF/struts config.xml
2
Integrating JavaServer Faces with Struts | 465
This is the Title of the Book, eMatter Edition
Copyright 2005 O'Reilly & Associates, Inc. All rights reserved.
footer
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved