I want to send a function of Js from a Jsf bean with RequestContext, but for some strange reason the function is executed twice.
This is the code of my xhtml:
<h:form >
<p:commandButton class="btn"
value="Llamar js Function"
action="#{developerController.foo}"/>
</h:form>
This is my bean code:
@Named(value = "developerController")
@SessionScoped
public class DeveloperController implements Serializable {
@EJB
QuoteManager quoteManager;
public DeveloperController() {
}
public void foo() {
RequestContext requestContext = RequestContext.getCurrentInstance();
requestContext.execute("alert('Hola');");
}
}
What should I do to have the "alert ()" run one instead of twice?
I'm using primefaces 6.0 and Glassfish 4.1