Examples Application
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!
Installing and Running the Examples
- 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
Using MyFaces in your own web application
Suggested step:
- Look at the compatibility list to find out if your servlet container is supported.
There are two possible ways to start off with MyFaces, one is to start from the example-app:
- If you want to have it simple, take the myfaces-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 second 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"%>
Using the MyFaces extensions (aka Tomahawk) in your own web application
- 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" %>