Saturday, November 5, 2011

Icefaces 2.0.2 with Grails

I finally managed to get Icefaces 2.0.2 to run with Grails. The steps are as follows:

1) Create a new grails application:
grails create-app myapp
cd myapp

2) Install the jsf2 plugin:
grails install-plugin jsf2

3) Install the templates to edit the web.xml file:
grails install-templates

4) Copy the following JARs into the lib directory:
icefaces-2.0.2.jar
icefaces-ace-2.0.2.jar
icefaces-compat-2.0.2.jar
icepush.jar

5) Add the following lines into the web.xml template in src/templates/war:
<servlet>
<servlet-name>Resource Servlet</servlet-name>
<servlet-class>com.icesoft.faces.webapp.CompatResourceServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/xmlhttp/*</url-pattern>
</servlet-mapping>

<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>

<context-param>
<param-name>javax.faces.VALIDATE_EMPTY_FIELDS</param-name>
<param-value>false</param-value>
</context-param>

And that's it. You can now create JSF files with the extension .xhtml in
the grails-app/view directory (following the JSF2 format).

No comments:

Post a Comment