JBoss.orgCommunity Documentation

6.20.  < a4j:queue >

The <a4j:queue> component creates queues of requests of Ajax request that other Ajax4JSF or RichFaces components can reference and use.

This component can manage server requests of the components, which referred to it, with help of its attributes.

Table 6.39. a4j : queue attributes

Attribute NameDescription
bindingThe attribute takes a value-binding expression for a component property of a backing bean
disabledIf "true", disables this component on page.
idEvery component may have a unique id that is automatically created if omitted
ignoreDupResponsesAttribute allows you to ignore an Ajax response produced by a request if the newest 'similar' request is in the queue already. ignoreDupResponses="true" does not cancel the request while it is processed on the server, but just allows avoiding unnecessary updates on the client side if the response isn't actual now
nameThe name of the queue
onbeforedomupdateJavaScript code for call before DOM has been updated on client side
oncompleteJavaScript code for call after request completed on client side
onerrorHTML: a script expression; event fires whenever an JavaScript server side error occurs
onrequestdequeueonrequestdequeue
onrequestqueueonrequestqueue
onsizeexceededA script expression; a size is exceed
onsubmitJavaScript code for call before submission of an ajax request
requestDelayAttribute defines the time (in ms) the request will be waiting in the queue before it is ready to be sent.
sizeDefines the number of requests allowed in the queue at one time.
sizeExceededBehaviorDefines the strategies of the queue's behavior if the number of the requests waiting in the queue is exceeded. There are four strategies: dropNext (by default), dropNew, fireNext , fireNew.
statusstatus
timeoutWaiting time for response on a particular request. If no response is received during this time, the request is aborted

Table 6.40. Component identification parameters

NameValue
component-familyorg.ajax4jsf.Queue
component-classorg.ajax4jsf.component.html.HtmlQueue
renderer-typeorg.ajax4jsf.QueueRenderer
tag-classorg.ajax4jsf.taglib.html.jsp.QueueTag

In order to create the named queue, see following example.

Example:


<a4j:queue name="myQueue" ... />
...
<h:inputText value="#{myQueue.text}">
    <a:support id="onblur" event="onblur" eventsQueue="myQueue"/>
</h:inputText>
...
<a4j:commandButton eventsQueue="myQueue" ... >

You can also create the queue with a default name. This queue is global for the all form. See the example below.

Example:


<h:form>
            ...
       <a4j:queue/>
       ...
</h:form>

Example:

import org.ajax4jsf.component.html.HtmlQueue;            

...
HtmlQueue myQueue = new HtmlQueue();

By means of the <a4j:queue> component you can create several types of queues associated with it.

The "size" attribute helps you to set the number of requests allowed in the queue at one time.

The "sizeExceededBehavior" attribute defines four strategies of the queue's behavior if the number of the requests waiting in the queue is exceeded:

The "requestDelay" attribute defines delay time for all the requests which fired using this queue.

Example:


<a4j:queue requestDelay="2000" ... />

As a result all the requests are fired with to 2 sec delay.

The requests collected in the queue, combining similar ones, during request delay. Note, that such requests can combine, if they are raised sequentially, in order to not block the queue and not to change the requests order.

Here you can see the example of <a4j:queue> usage and sources for the given example.