JSF AJAX Example

JSF AJAX Example

Java Server Faces technology supports Ajax by using its built-in JavaScript resource library which is provided as part of the Java Server Faces core libraries. The built-in Ajax resource can be used in Java Server Faces web applications in one of the following ways:

  • By using the f:ajax tag along with another standard component in a Facelets application. This method adds Ajax functionality to any UI component without additional coding and configuration.
  • By using the JavaScript API method jsf.ajax.request() directly within the Facelets application. This method provides direct access to Ajax methods, and allows customized control of component behavior.

In this demo you will see how to use f:ajax Tag to execute Ajax.

Tools needed:

  • Eclipse Luna (You can use any version) and install JBoss Tools plug-in into it so that you can create maven project directly from Eclipse.
  • Tomcat server (I will use version 7)


  • Create maven project name: JSFAJAXDemo in eclipse if you are not sure how to create it please follow this tutorial. Below is final project structure:

JSF AJAX Example

  • pom.xml:

  • web.xml:

  • JSFAJAXDemo.xhtml:

  • JSFAJAX.java:

  • Run this example on any server. We have used tomcat server below will be output:

JSF AJAX Example

JSF AJAX Example

  • For more details please visit Oracle JSF documentation here

download  Download Project:  JSFAJAXDemo

Leave a Reply

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

I am not Robot *