I have a
<a4j:commandButton action="#{myBean.doCalculation}"
oncomplete="redirectBrowser()" />
However, if there is an error at myBean.doCalculation()
, then oncomplete
attribute is always invoked. How do I let it depend on result of action method?
You can check for errors in the oncomplete event and redirect when none are found. It can be done like this
oncomplete="#{facesContext.maximumSeverity == null ? 'redirectBrowser()' : 'doSomethingElse()'}"