JSF 2 Eclipse Tomcat 7
- Download JDK 6 to for example C:\java\jdk6
- Download Tomcat 7 from http://tomcat.apache.org/download-70.cgi – select the zip option under Core. Unzip into for example C:\apache-tomcat-7.0.8.
- Download Mojarra JSF implementation 2 from http://javaserverfaces.java.net/. Unzip into for example c:\mojarra-2.0.4-FCS. The required jars are inside the lib folder here.
- Start eclipse Helios. Select New–>Other–>Web–>Dynamic Web Project. Give a project name Example. Create a new runtime. Point to Tomcat version 7. Check create new local server. For the location of the tomcat installation use C:\apache-tomcat-7.0.8 from #2 above. Tomcat needs an SDK. So point the JDK location from #1 above while setting up Tomcat runtime in the New Server Runtime Environment screen.
- Select Dynamic web module version as 3.0 and Configuration as Java Server Faces version2.0 project.
- Clicking next, check Generate web.xml.
- Clicking next, JSF implementation library select user library manager libary icon. Create new user library add the JSF libraries from #3. Name the library as JSF2.0. Check this as the JSF implementation for the project. Click finish.
- I also added el-impl.jar, jstl1.2 jars to WEB-INF\lib folder in the eclipse project.
- Right click on the project Example –>Properties–> Java Build Path–>Source. Change the default output folder to Example/WebContent/classes. This makes the backing beans to be deployed correctly.
- Now you are ready to write facelets based JSF applications.