NOTE: See the updated documentation in our Confluence Wiki
Your first step with Apache MyFaces 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 tomahawk-X.X.X-examples.zip (or tomahawk-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
- Check the myfaces wiki for information about compatibility with your servlet container.
There are three possible ways to start off with MyFaces, one (recomended) is to start using myfaces archetypes:
- Download and Install Maven
- Execute mvn archetype:create goal using one available archetype. For more info you can look here
The second possibility is to start from the example-app:
- If you want to have it simple, take the tomahawk-X.X.X-examples.zip you downloaded before for looking at the examples, and extract the blank.war file (MyFaces binary)
- Rename the blank.war file to blank.zip, and extract this file - you have a working directory structure for a MyFaces application at hand after this step.
The third possibility is to download the core implementation and/or tomahawk (dependent on if you want to use the RI and the tomahawk components, or only MyFaces), and start from there:
- Alternatively, download the latest MyFaces binary release. You can download only the implementation (aka core) or the implementation and tomahawk.
- Copy all *.jar files into your WEB-INF/lib directory. Some of the jar-files are optional, you can find more info on: http://myfaces.apache.org/impl/dependencies.html and http://myfaces.apache.org/tomahawk/dependencies.html
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"%>
- If you don't use the MyFaces implementation, you will need to add the file tomahawk.jar and its dependencies (see above) to your web-app directory.
- To be able to use the MyFaces extensions (aka Tomahawk) add the following line to your JSPs:
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="http://myfaces.apache.org/wap" prefix="wap" %>