In PrimeFaces, we can invoke a javascript function from managed bean.
One of the good example is to keep dialog open when validation exception.
Besides, other javascript function can be called.
code in xhtml
code in managed bean
Done!!
One of the good example is to keep dialog open when validation exception.
Besides, other javascript function can be called.
code in xhtml
<p:commandButton value="Call JS from MB" action="#{myBean.callJsFromMB}" />
code in managed bean
public void callJsFromMB() {
// other business logic or validation
RequestContext.getCurrentInstance().execute("alert('test')");
}
Done!!
No comments:
Post a Comment