Use a4j:status to display status of the request

a4j:support and a4j:status

When there is a request to the server, the client have to wait untill he gets the response. It will be nice if you give status of the server request processing. use a4j:status tag in the RichFaces to implement this feature in your webpages. In this example this tag is used with a4j:support and showing the status message while user types in the text field.

also read:

This example also used some other useful attributes in the tag. Ti display the text message use starttext and stoptext. if you want to use image instaed of displaying text, the use

         <f:facet name="start">
                <h:graphicImage  value="process.gif"/>


Display the different styles using startStyle and stopstyle attributes.


<%@taglib prefix="f" uri=""%>
<%@taglib prefix="h" uri=""%>
<%@ taglib prefix="rich" uri="" %>
<%@ taglib prefix="a4j" uri=""%>
            <h:form id="jbForm1">
                <h:outputText value="Employee id : "/>
                <h:inputText value="#{richBean.empId}">
                    <a4j:support event="onkeyup" reRender="output" action="#{richBean.update}" />
            <h:panelGrid id="output">
                    <a4j:status startText="Processing...." stopText="Processed." startStyle="color:green" stopStyle="color:red"/>
                    <h:outputText value="Updated Values : "/>
                    <h:outputText value="#{}"/>
                    <h:outputText value="#{richBean.status}"/>



import java.util.HashMap;
import java.util.Map;

public class JavaBeatRichfacesBean {
    private String name;
    private Integer empId;
    private String status;

    public Integer getEmpId() {
        return empId;

    public void setEmpId(Integer empId) {
        this.empId = empId;

    public String getStatus() {
        return status;

    public void setStatus(String status) {
        this.status = status;

    public String getName() {
        return name;
    public void setName(String name) { = name;
    public void update(){
        Map<integer,String> map = new HashMap<integer,String>();
        map.put(1, "Employee One");
        map.put(2, "Employee Two");
        map.put(3, "Employee Three");
        map.put(4, "Employee Four"); = map.get(this.empId);
        if ( == null || == 0)
            this.status = "No Matching Found";



<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="1.2"

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest

Share This

Share this post with your friends!