Calling a JSF bean method inside JavaScript

0

I would like to call a JSF method inside my JavaScript code. For every time it executes this method in JavaScript within the function call another method that is inside JSF.

Does anyone have any idea how to do this?

    
asked by anonymous 05.05.2015 / 01:16

1 answer

2

You can use the PrimeFaces framework that contains a component for this, here's an example.

<h:form>
  <p:remoteCommand name="rc" update="msgs" actionListener="#{remoteCommandView.execute}" />

  <p:growl id="msgs" showDetail="true" />
  <p:commandButton type="button" onclick="rc()" value="Execute" icon="ui-icon-refresh" />
</h:form>

In this component, <p:remoteCommand> , the name attribute determines a JavaScript function in which you can call to execute the JSF method defined in the actionListerner attribute.

For more information and documentation on the component, see this link .

    
05.05.2015 / 01:30