Send your remarks, comments or wishes to doc team
Subject:
Message:
Your name:
Your email:

JBoss.org Community Documentation

- Prev
- Next

## 6.20. < a4j:queue >

### 6.20.1. Description

The <a4j:queue> component creates queues that other components can reference and use.

Table 6.39. a4j : queue attributes

Attribute Name | Description
--- | ---
binding | The attribute takes a value-binding expression for a component property of a backing bean
disabled | If "true", disable this component on page.
id | Every component may have a unique id that is automatically created if omitted
ignoreDupResponses | Attribute allows to ignore an Ajax Response produced by a request if the newest 'similar' request is in a queue already. ignoreDupResponses="true" does not cancel the request while it is processed on the server, but just allows to avoid unnecessary updates on the client side if the response isn't actual now
name | The optional name of this component
onbeforedomupdate | JavaScript code for call before DOM has been updated on client side
oncomplete | JavaScript code for call after request completed on client side
onerror | HTML: a script expression; event fires whenever an JavaScript error occurs
onsizeexceeded | A script expression; a size is exceed
onsubmit | JavaScript code for call before submission of ajax event
requestDelay | Attribute defines the time (in ms.) that the request will be wait in the queue before it is ready to send. When the delay time is over, the request will be sent to the server or removed if the newest 'similar' request is in a queue already
size | Defines the number of items allowed in the queue at one time.
sizeExceededBehavior | Defines 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.
timeout | Response waiting time on a particular request. If a response is not received during this time, the request is aborted

Table 6.40. Component identification parameters

Name | Value
--- | ---
component-family | org.ajax4jsf.Queue
component-class | org.ajax4jsf.component.html.HtmlQueue
renderer-type | org.ajax4jsf.QueueRenderer
tag-class | org.ajax4jsf.taglib.html.jsp.QueueTag

### 6.20.2. Creating on a page

Here is the simplest way for a component creation on a page.

Example:

    <h:form>

           <a4j:queue name="fooQueue" ... />

    </h:form>

### 6.20.3. Creating the Component Dynamically Using Java

Example:

    import org.ajax4jsf.component.html.HtmlQueue;

    ...

    HtmlQueue myQueue = new HtmlQueue();

### 6.20.4. Key attributes and ways of usage

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

- A user can set a queue globally in "web.xml". You don't need set the queue on the page itself. The global queue can be used by all components. Example you can see below:

      <context-param>

         <param-name>org.richfaces.queue.global.enabled</param-name>

         <param-value>true</param-value>

         </context-param>

  The global queue can be disabled for specifically view's application.

  In order to enable/disable a global queue see the following examples:

      <a4j:queue name="org.richfaces.global_queue" disabled="false"... />

  or:

      <a4j:queue name="org.richfaces.global_queue" disabled="true"... />

- A user can create separate queue for specific form with the help of the <a4j:form> or <h:form> tags. It will be the global queue only for this form.

  Example:

      <h:form ... >

          ...

          <a4j:queue ... />

          ...

          </h:form>

  or:

  Example:

      <a4j:form ... >

          ...

          <a4j:queue <a4j:queue name="fooQueue" ... />

          ...

      </a4j:form>

  If you use <a4j:form> tag, you can reference a named queue as the form's default.

  Example:

      <a4j:form eventsQueue="fooQueue" ...>

         ...

         </a4j:form>

- With the help of the "eventsQueue" attribute a user can reference a named queue from any a4j or rich component that supports this attribute.

  Example:

      <a4j:queue name="fooQueue" ... />

      ...

      <h:inputText value="#{foo2.bar1}">

          <a:support id="onblur" event="onblur" reRender="bar21" eventsQueue="fooQueue"/>

      </h:inputText>

      <a4j:commandButton eventsQueue="fooQueue" ... >

  As a result all requests generated through the onblur of the <h:inputText> component, and clicking of the <h:commandButton> will be funneled through the `"fooQueue"`.

  If you have a try to reference a nonexistent queue a new named queue will be created with all default settings.

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

### 6.20.5. Relevant resources links

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

- Prev6.19. < a4j:push >
- Top of page
- Front page
- Next6.21. < a4j:region >