0

While trying to incorporate RichFaces with OpenFaces in a tree table, and it doesn't display any expand collapse buttons. It turned out that some of the js are not loaded, which might be the cause of it.

JSF code is as follows:

<o:treeTable var="o">
                        <o:dynamicTreeStructure nodeChildren="#{bean.originNodeChildren}"
                                                nodeHasChildren="#{bean.originHasChildren()}"/>
                        <o:treeColumn expandedToggleImageUrl="/img/toggle-expand-light.png"
                                      collapsedToggleImageUrl="img/toggle-collapse-light.png">
                            <h:outputText value="#{o.description}"/>
                        </o:treeColumn>
                    </o:treeTable>

Bean code is being triggered correctly (including hasChildren method).

JS exceptions:

Failed to load resource: the server responded with a status of 404 (/openFacesResources/META-INF/resources/openfaces/util/ajaxUtil-2.1.EA1.1143.js)
Failed to load resource: the server responded with a status of 404 (/openFacesResources/META-INF/resources/openfaces/util/util-2.1.EA1.1143.js)
Failed to load resource: the server responded with a status of 404 (/openFacesResources/META-INF/resources/openfaces/tableUtil-2.1.EA1.1143.js)
Failed to load resource: the server responded with a status of 404 (/openFacesResources/META-INF/resources/openfaces/table/table-2.1.EA1.1143.js)
Failed to load resource: the server responded with a status of 404 (/openFacesResources/META-INF/resources/openfaces/table/treeTable-2.1.EA1.1143.js)

Using OpenFaces version 2.0 and RichFaces version 3.3.3.

Denys S.
  • 6,358
  • 12
  • 43
  • 65

2 Answers2

1

It is needed to configure resource filter for open faces in web.xml and the job is done. Something like:

public class OpenFacesResourceFilter extends ResourceFilter {
    // -- Fields --

    // -- Methods --
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        try{
            super.doFilter(servletRequest, servletResponse, filterChain);
        } catch (ServletException e) {
            Throwable parent = e.getCause();
            if(parent!=null && parent instanceof ServletException) {
                throw (ServletException) parent;
            } else {
                throw e;
            }
        }
    }
}
Denys S.
  • 6,358
  • 12
  • 43
  • 65
0

This looks like you have not declared the OpenFaces resource filter in the application's xml file indeed. Here's an excerpt from documentation on how a filter can be declared (note that you don't have to create any Java classes for this filter yourself):

  <!-- FILTER FOR PROCESSING INTERNAL OPENFACES RESOURCES -->
  <filter>
    <filter-name>ResourceFilter</filter-name>
    <filter-class>org.openfaces.util.ResourceFilter</filter-class>
  </filter>

  <!-- MAPPING FOR OPENFACES RESOURCE FILTER -->
  <filter-mapping>
    <filter-name>ResourceFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

See the Installation section, and the Resource Filter Optimization sections in OpenFaces 2.0 documentation.

Dmitry Pikhulya
  • 446
  • 2
  • 6