According to JSF 2.3, this can be used <h:commandScript>. See also specification 613 .
<h:form>
<h:commandScript name="foo" action="#{bean.action}" render="div-to-render" />
</h:form>
function clickAndRender() {
foo();
}
Available since Mojarra 2.3.0-m06 .
This answer was updated, as before, 3 years after the publication of the question. Below is the original answer when dated, when <h:commandScript>does not exist.
I have no idea what the value of the source parameter (the code above uses 'this') should be
UICommand, , . <h:commandLink>, <h:commandButton> .., API JSF. , JSF ().
, .
, , . , <f:ajax execute>.
, URL-,
, <form>, <h:form>, UICommand . jsf.ajax.request(). jsf.js UICommand.
.
action actionListener UICommand .
, , UICommand , jsf.ajax.request(). , CSS display:none:
<h:form id="foo" style="display:none">
<h:commandLink id="bar" action="#{bean.method}" />
</h:form>
foo:bar source.
jsf.ajax.request('foo:bar', null, {'javax.faces.behavior.event': 'action', 'execute': '@form', 'render': 'div-to-render'});
, <f:ajax execute="@form" render="div-to-render"> . , document.getElementById("foo:bar").click() jsf.ajax.request().
UICommand, JavaScript. JSF OmniFaces , <o:commandScript>. . . JSF PrimeFaces <p:remoteCommand>. . . RichFaces <a4j:jsFunction>, . . .