If you do this:
<h:commandButton action="..." onclick="return false" />
The action will not occur.
The same does not work for <f:ajax>开发者_JAVA技巧
, meaning this doesn't work:
<f:ajax event="click" onevent="return false" listener="#{mrBean.doSomething()}" >
<h:commandLink value="A Link" \>
</f:ajax>
Or more correctly, the ajax action runs and I get this error in the javascript console:
Uncaught SyntaxError: Unexpected token return
myfaces._impl.core._Runtime.singletonExtendClass.chainjsf.js.jsf:7491
chainjsf.js.jsf:7696
(anonymous function)file.jsf
onclick
Is there a way abort the <f:ajax>
action through a javascript in a similar fashion to the h:commandbutton
example?
I did this:
<f:ajax event="click" onevent="doTheRefreshingPart()" listener="#{mrBean.doSomething()}" >
<h:commandLink value="A Link" onclick="return doTheConfirmationPart" \>
</f:ajax>
I moved the part that is confirmation dependent to the actual commandlink and left the part that takes part of refreshing the page in the <f:ajax>
part
精彩评论