Home » Primefaces Ajax Dropdown

Primefaces Ajax Dropdown

by Online Tutorials Library

PrimeFaces Ajax Dropdown

PrimeFaces provides an easy way to create dynamic dropdown on the basis of filter. A new dropdown is formed by Ajax call. The <p:ajax> tag call Java method after each event is occurred.

In the following example, we are creating two dropdown. This example includes the following files.

JSF File

// ajax-dropdown.xhtml

ManagedBean

// Dropdown.java

After executing, it produces the following output.

Output:

PrimeFaces Dropdown 1

The second dropdown contains the city names for each country. Each time country is selected, city dynamically updates.

PrimeFaces Dropdown 2
PrimeFaces Dropdown 3

You may also like