a4j:support – Simple Example on onkeyup event


This example program demonstrates how to get started with a4j:support tag in the
RiachFaces tag libraray. This is part of Ajax4jsf libraray. But, from RiachFaces 3.0, Ajax4jsf is merged with RichFaces tag libraray. a4j:support is used inside any component to provide ajax support on that particular field.

also read:

In our example a4j:support allows user developer to directly map a text filed and one output filed. When user types in, the typed characters are displayed same time on the output field. This is done using the Ajax call to the server.


<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib prefix="rich" uri="http://richfaces.org/rich" %>
<%@ taglib prefix="a4j" uri="http://richfaces.org/a4j"%>
            <h:form id="jbForm1">
                <h:inputText value="#{richBean.name}">
                    <a4j:support event="onkeyup" reRender="output"/>
            <h:outputText id="output" style="font-weight:bold" value="Typed Name: #{richBean.name}" />


package javabeat.net.richfaces;

public class JavaBeatRichfacesBean {
    private String name;

    public String getName() {
        return name;

    public void setName(String name) {
        this.name = name;



<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="1.2"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">



About Krishna Srinivasan

He is Founder and Chief Editor of JavaBeat. He has more than 8+ years of experience on developing Web applications. He writes about Spring, DOJO, JSF, Hibernate and many other emerging technologies in this blog.

  • Flávio


    I ran this sample and unfortunately didn’t work.

    • Guillermo

      I am afraid, it didnt work for me either.

      • Aditya

        It is working!