In this example, we will see how to update dialog content dynamically. As compare to our last example, here we need to use the 'update' attribute of CommandButton and the oncomplete event instead of onclick because onclick is executed before ajax update.
@ManagedBean
public class ExampleBean {
public String getTime() {
return LocalTime.now().toString();
}
}
To try examples, run embedded tomcat (configured in pom.xml of example project below):
mvn tomcat7:run-war
Output
In this case (as compared to the last example), the dialog's content will get updated on each invocation. Here, we can still use the attribute dynamic="true" of <p:dialog /> to speed up the page's initial load time.
Example Project
Dependencies and Technologies Used:
primefaces 6.1 primefaces
jsf-api 2.2.14:
This is the master POM file for Oracle's Implementation of the JSF 2.2 Specification.
jsf-impl 2.2.14:
This is the master POM file for Oracle's Implementation of the JSF 2.2 Specification.