如何在ajax请求之前执行actionListener?
<h:commandButton actionListener=.. action=..>
<f:ajax render="test">
</h:commandButton>
执行顺序是:
test
actionListener
action
我可以更改什么,以便在f:ajax?
之前执行actionListener方法完整示例:
<h:form>
<h:commandButton value="test" actionListener="#{bean.toggleProgress}" action="#{bean.do()}" >
<f:ajax execute="@form" render="progress" />
</h:commandButton>
<h:panelGroup id="progress" >
<h:outputText rendered="#{bean.progress}" />
</h:panelGroup>
</h:form>
class Bean {
private progress = false;
public boolean isProgress() {
System.out.println("in: ajax")
return progress;
}
public toggleProgress(ActionEvent e) {
System.out.println("in: actionListener")
progress = true;
}
public void do() {
System.out.println("in: action")
}
}
systout是:
in: ajax
in: actionListener
in: action