Home » Primefaces Ajax Actionlistener

Primefaces Ajax Actionlistener

by Online Tutorials Library

PrimeFaces Ajax ActionListener

It is used to call Java method by triggering action. This action can be done either by using commandButton or commandLink. Here, we are creating and example that call a method of ManagedBean and each time the button is clicked the current value is updated with Ajax.

This example includes the following files.

JSF File

// actionListener.xhtml

Managed Bean

// AjaxCounter.java

Output:

PrimeFaces Actionlistener example 1

After clicking on the commandButton, it calls the method and increments the counter by 2.

PrimeFaces Actionlistener example 2

You may also like