16 Aug

Custom ELResolver ordering in MyFaces

As with MyFaces core 2.0.2 (or 1.2.10) it is possible to change the predefined order or ELResolvers.

To change this predefined order you can provide a java.util.Comparator<ELResolver> implementation which will be applied to the List of ELResolvers mentioned above.

To install the comparator you simply have to set a web.xml config parameter:

<context-param>
    <param-name>
        org.apache.myfaces.EL_RESOLVER_COMPARATOR
    </param-name>
    <param-value>
        com.acme.el.MyELResolverComparator
    </param-value>
</context-param>

Apache OpenWebBeans optimization

To optimize the marriage of MyFaces and OpenWebBeans, you simply have to set the following config parameter:

<context-param>
    <param-name>
        org.apache.myfaces.EL_RESOLVER_COMPARATOR
    </param-name>
    <param-value>
        org.apache.myfaces.el.unified.OpenWebBeansELResolverComparator
    </param-value>
</context-param>

This moves the WebBeansELResolver almost to the last place in the ELResolver chain, thus improving the overall performance of ELExpression evaluations.

Links

You can find more info in the MyFaces cwiki at https://cwiki.apache.org/confluence/display/MYFACES/ELResolver+ordering