PrimeFaces Beginner's Guide
上QQ阅读APP看书,第一时间看更新

Updating the view using AJAX listeners

Sometimes we may need instant feedback to be shown as and so user fills the form, instead of showing error messages after form submission. For example, in user Registration Form, we may want to check whether the UserName is already in use and show an error message immediately.

PrimeFaces provides AJAX listener support to invoke method on JSF managed bean. We can use this feature to check whether the entered UserName is already in use or not, and update the view to show error message using AJAX, even before submitting the entire form.