AjaxRenderKitFactory is blocking AJAX in my web project

417 Views Asked by At

I am facing an issue related to Ajax in JSF 2.0

We have 2 web projects (WARs) in the same EAR. the first project is having the following in the faces-config.xml

<factory>

    <faces-context-factory>

        com.ibm.faces.context.AjaxFacesContextFactory

    </faces-context-factory>

    <render-kit-factory>

        com.ibm.faces.renderkit.AjaxRenderKitFactory

    </render-kit-factory>

</factory>

For some reason, the com.ibm.faces.renderkit.AjaxRenderKitFactory is blocking ajax in the other web project, if I removed this section, ajax works fine.

I mean by Ajax here, the rendering for

    <h:form>
        <h:selectOneMenu value="#{myBean.selected}">
            <f:selectItem itemValue="#{null}" itemLabel="ABC" />
            <f:selectItem itemValue="one" />
            <f:selectItem itemValue="two" />
            <f:selectItem itemValue="three" />
            <f:ajax listener="#{myBean.listener}" render="result" />
        </h:selectOneMenu>

        <h:outputText id="result" value="#{myBean.selected} #{myBean.result}" />

but the following is working fine

        <h:commandButton value="commandButton" action="#{myBean.submit}">
            <f:ajax listener="#{myBean.listener}" render="result" />
        </h:commandButton>

        <h:outputText id="result" value="#{myBean.selected} #{myBean.result}" />

I am not having this com.ibm.faces.renderkit.AjaxRenderKitFactory in my faces-config so why it is affecting Ajax in my project?

1

There are 1 best solutions below

0
On

The com.ibm.faces.renderkit.AjaxRenderKitFactory is designed to enable ajax support in jurassic JSF 1.x versions which didn't have built-in ajax support.

Since JSF 2.0 (Dec 2009), JSF got built-in ajax support with the new <f:ajax> tag. Therefore, external ajax libraries designed for JSF 1.x such as those from IBM becomes unnecessary and they would possibly even conflict, as you faced.

Just remove it altogether. In JSF 2.x and newer you don't need external libraries to use ajax. Moreover, you should upgrade any JSF 1.x component libraries to a JSF 2.x compatible one.