Saturday, March 10, 2007

How to setup TOMCAT 6.0.x to run JSF 1.2 web applications

After I installed Tomcat 6.0.10, i wanted to try out an application which makes use of JSF 1.2. It did not work out of the box. I have to follow the below steps to get it working.

  1. Install apache tomcat 6.0.x in some directory
  2. Download JSF 1.2 reference implementation from this link and install in some temporary directory. Copy the jsf-api.jar and jsf-impl.jar to TOMCAT_HOME/lib.
  3. Download JSTL tag library jar file from this link and copy it into TOMCAT_HOME/lib directory
  4. Add the following lines in the TOMCAT_HOME/conf/web.xml right after the start web-app tag as shown in bold lines below
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">
    <context-param>
    <param-name>com.sun.faces.expressionFactory
    </param-name>
    <param-value>org.apache.el.ExpressionFactoryImpl
    </param-value>
    </context-param>


  5. Test your installation by copying the jsf-cardemo.war file from the JSF reference implementation samples directory into TOMCAT_HOME\webapps directory, starting tomcat 6.0.x and pointing the browser to url http://localhost:8080/jsf-cardemo.