Disabling Ajax

Table of Contents

Disabling Ajax

ICEfaces makes it very easy to add Ajax capabilities to existing JSF applications. Simply adding the icefaces.jar to a JSF application adds Ajax by affecting the necessary changes in the page markup. The result is that interactions with the components automatically trigger the use of Ajax during form submission.

However, for certain situations (for example diagnosing problems or submitting non-Ajax requests), it may be useful to turn off ICEfaces' automatic Ajax behaviour. There are a number of different ways to accomplish this depending on the level of Ajax support required.

Disabling ICEfaces for all Views

You can use a context parameter in your web.xml to quickly disable ICEfaces' for the entire application:

    <context-param>
        <param-name>org.icefaces.render.auto</param-name>
        <param-value>false</param-value>
    </context-param>

For more information, see the Configuration section regarding ICEfaces rendering.

Disable ICEfaces for the View

ICEfaces also provides the custom icecore:config tag to turn off rendering for a single view by setting the render attribute to "false" in your markup. This tag works together with the context parameter described above to control ICEfaces on a view-by-view basis.

<icecore:config render="false"/>

For more information, see the Configuration section ICEfaces rendering.

Disable Ajax for a Form

For more specific control, you can disable Ajax for a form and it's contents by wrapping it with the f:ajax tag and setting disabled to "true".

<h:form > 
        <f:ajax event="click" disabled="true" /> 

or wrap that form in an ajax tag:

<f:ajax event="click" disabled="true" > 
  <h:form > 
Note the event="click" is required for the form tag to detect the ajax disabled condition as it does not respond to the default action event of the ajax tag.

However, since the <f:ajax> tag is a standard JSF feature, disabling ICEfaces this way may have unintended side effects during JSF processing. In those cases, ICEfaces provides a custom form attribute:

<h:form > 
        <f:attribute name="DISABLE_CAPTURE_SUBMIT" value="true" /> 

If the form element contains the attribute DISABLE_CAPTURE_SUBMIT then the automatic Ajax capturing function ice.captureSubmit() is not written, effectively disabling ICEfaces event capturing.

This attribute is intended for diagnostic purposes only. It may be changed or removed in future releases.
Disable Ajax for a Component

You can also disable Ajax at the level of the individual component:

<h:commandButton value="Send" actionListener="#{bean.sendMessage}">
    <f:ajax disabled="true"/>
</h:commandButton>
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

© Copyright 2013 ICEsoft Technologies Canada Corp.