JBoss.orgCommunity Documentation
The <a4j:status> component generates elements for displaying of the current Ajax requests status. There are two status modes: Ajax request is in process or finished.
Table 6.9. a4j : status attributes
Attribute Name | Description |
---|---|
binding | The attribute takes a value-binding expression for a component property of a backing bean |
dir | Direction indication for text that does not inherit directionality. Valid values are "LTR" (left-to-right) and "RTL" (right-to-left) |
for | ID of the AjaxContainer component whose status is indicated (in the format of a javax.faces.UIComopnent.findComponent() call). |
forceId | If true, render the ID of the component in HTML code without JSF modifications. |
id | Every component may have a unique id that is automatically created if omitted |
lang | Code describing the language used in the generated markup for this component |
layout | Define visual layout of panel, can be "block" or "inline". |
onclick | The clientside script method to be called when the element is clicked |
ondblclick | The client side script method to be called when the element is double-clicked |
onkeydown | The client side script method to be called when a key is pressed down over the element |
onkeypress | The client side script method to be called when a key is pressed over the element and released |
onkeyup | The client side script method to be called when a key is released |
onmousedown | The client side script method to be called when a mouse button is pressed down over the element |
onmousemove | The client side script method to be called when a pointer is moved within the element |
onmouseout | The client side script method to be called when a pointer is moved away from the element |
onmouseover | The client side script method to be called when a pointer is moved onto the element |
onmouseup | The client side script method to be called when a mouse button is released |
onstart | JavaScript code, called on the start of a request. |
onstop | JavaScript code, called on the stop of a request. |
rendered | If "false", this component is not rendered |
startStyle | CSS style class for the element displayed on the start of a request. |
startStyleClass | CSS style class for the element displayed on the start of a request. |
startText | Text for display on starting request. |
stopStyle | CSS style for element displayed on request completion. |
stopStyleClass | CSS style class for element displayed on request |
stopText | Text for display on request complete. |
style | CSS style(s) is/are to be applied when this component is rendered |
styleClass | Corresponds to the HTML class attribute |
title | Advisory title information about markup elements generated for this component |
Table 6.10. Component identification parameters
Name | Value |
---|---|
component-type | org.ajax4jsf.Status |
component-family | javax.faces.Panel |
component-class | org.ajax4jsf.component.html.HtmlAjaxStatus |
renderer-type | org.ajax4jsf.components.AjaxStatusRenderer |
There are two ways to define elements indicating a request status :
With "StartText"/"StopText" atributes:
<a4j:status startText="Progress" stopText="Done" for="stat1">
In this case, text elements for the corresponding status are generated.
With "Start" / "Stop" facets definition:
<a4j:status for="stat2">
<f:facet name="start">
<h:graphicImage value="ajax_process.png" />
</f:facet>
<f:facet name="stop">
<h:graphicImage value="ajax_stoped.png" />
</f:facet>
</a4j:status>
In this case, the elements are generated for each status and correspond the facets content.
Example:
import org.ajax4jsf.component.html.HtmlAjaxStatus;
...
HtmlAjaxStatus myStatus = new HtmlAjaxStatus();
...
Table 6.11. Facets
Facet name | Description |
---|---|
start | Redefines the content for display on starting request |
stop | Redefines the content for display on request complete |
There are two ways for the components or containers definition, which Ajax requests status is tracked by a component.
Definition with the "for" attribute on the <a4j:status> component. Here "for" attribute should point at an Ajax container ( <a4j:region> ) id, which requests are tracked by a component.
Definition with the "status" attribute obtained by any RichFaces library action component. The attribute should point at the <a4j:status> component id. Then this <a4j:status> component shows the status for the request fired from this action component.
The component creates two <span> or <div> elements depending on attribute "layout" with content defined for each status, one of the elements (start) is initially hidden. At the beginning of an Ajax request, elements state is inversed, hence the second element is shown and the first is hidden. At the end of a response processing, elements display states return to its initial values.
Example:
<a4j:status startText="Started" stopText="stopped" />
The code shown in the example above is decoded on a page as:
<span id="j_id20:status.start" style="display: none">
Started
</span>
<span id="j_id20:status.stop">
Stopped
</span>
and after the generation of an Ajax response is changed to:
<span id="j_id20:status.start">
Started
</span>
<span id="j_id20:status.stop" style="display: none">
Stopped
</span>
There is a possibility to group a <a4j:status> elements content into <div> elements, instead of <span> . To use it, just redefine the "layout" attribute from "inline" (default) to "block".
Here you can find information on how to show a "Please Wait" box and block the input while the Ajax request is processed using combination of <a4j:status> and <rich:modalPanel> components .
On the component Live Demo page you can see the example of <a4j:status> usage and sources for the given example.