user2307786 user2307786 - 1 month ago 9
Javascript Question

there is a way to call javascript function from prime faces

I tried to call javascript function in my xhtml page by using RequestContext but I could not succeed it. Is there a way to call javascript function from view bean at prime faces ?

If the questions is not clear then I can provide code.

Answer Source

Like @Parkash Kumar said, you can call it from the bean, like this:

RequestContext.getCurrentInstance().execute("alert('script called.')");

or directly from the xhtml:

<p:commandButton value="Save" actionListener="#{}" oncomplete="handleComplete(xhr, status, args)" />