JSF Integration

DWR contains 2 extension points for JSF, a creator and a ServletFilter.

The 'jsf' Creator

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

<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.

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>uk.ltd.getahead.dwr.servlet.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.