86
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:
The second dropdown contains the city names for each country. Each time country is selected, city dynamically updates.
Next TopicPrimeFaces Ajax Poll