JSF Integration

DWR contains 2 extension points for JSF, a creator and a ServletFilter. The JSF integration is not included in the dwr.jar. It is currently only available in the dwr-noncla.jar which is available for download.

The 'jsf' Creator

An experimental JsfCreator is included with the normal DWR download. You can use this from dwr.xml as follows:

<init>
  <creator id="jsf" class="org.directwebremoting.faces.JsfCreator"/>
</init>

<allow>
  ...
  <create creator="jsf" javascript="ScriptName">
    <param name="managedBeanName" value="beanName"/>
    <param name="class" value="your.class"/>
  </create>
  ...
</allow>

This will allow you to make calls into your ManagedBeans from DWR. Please note the init section. This section is required because the JSF creator is not defined in the standard dwr.xml (because of the non-cla issue).

The Servlet Filter

The DWR/Faces filter allows you to access beans from your FacesContext without being officially part of the JSF lifecycle.

In order to use the JsfCreator, you should add the DWR/Faces filter to your web.xml file.

<filter>
  <filter-name>DwrFacesFilter</filter-name>
  <filter-class>org.directwebremoting.faces.FacesExtensionFilter</filter-class>
</filter>

<filter-mapping>
  <filter-name>DwrFacesFilter</filter-name>
  <url-pattern>/dwr/*</url-pattern>
</filter-mapping>

The 2 elements will need to be placed alongside other filter and filter-mapping elements in your web.xml file.

This JSF integration was written by Pierpaolo Follia, with inspiration from an article from thoughtsabout.net.