Your first step with Apache MyFaces Core should be to have a look at our examples application. You can do that by going to our working distribution on http://www.irian.at/myfaces.jsf or by deploying the examples application yourself. All you need to do to get up and running is to follow the steps below!
- Unpack the MyFaces examples archive myfaces-X.X.X-examples.zip (or myfaces-X.X.X-examples.tgz) to a directory of your choice.
- Remove any previous MyFaces webapps from your Tomcat installation and clean up your Tomcat work dir. Also make sure that there is no jsf-api.jar or jsf-impl.jar (i.e. Suns API and implementation) in the classpath or in one of Tomcat's lib directories (common/lib or shared/lib).
- Copy the file simple.war (or any of the other example war-files) to the webapps dir of your Tomcat installation directory - and check once more that there is no old myfaces-examples directory there ;-)
- Start Tomcat, if its not already running.
- Start your browser and enjoy it at http://localhost:8080/simple
Because MyFaces Core is an implementation of the JSF standard, and Sun's examples use only standard JSF features, the examples provided with the Sun RI can also run on MyFaces Core.
First, check the compatibility list to find out if your servlet container is supported.
To create a new webapp, one easy way is to take the myfaces-X.X.X-examples.zip (see instructions above), and extract the blank.war file. This contains all the necessary libraries already, plus the necessary directory structure for a basic JSF webapp.
Alternatively, download the latest Myfaces Core tarfile. This will contain all the necessary dependencies.
After you have downloaded the necessary packages and setup your project hierarchy, do this:
- Make sure that there is no jsf-api.jar (i.e. Suns API implementation) in the classpath or in one of your container's shared lib directories (e.g. common/lib or shared/lib for Tomcat).
- Configure your webapp's web.xml file (see conf/web.xml for example and documentation)
- Add the following lines to your JSPs:
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>