是否可以执行两种方法<h:commandButton>
?
例如,
<h:commandButton action="#{bean.methodOne();bean.methodTwo();}" />
Run Code Online (Sandbox Code Playgroud)
Nar*_*ala 46
你可以f:actionListener
像这样使用.
<h:commandButton action="#{bean.methodOne();}">
<f:actionListener binding="#{bean.methodTwo();}" />
</h:commandButton>
Run Code Online (Sandbox Code Playgroud)
您可以f:actionListener
根据需要添加任意数量的元素.
在bean中添加一个methodThree:
public Object methodThree() {
methodOne();
methodTwo();
return someThing;
}
Run Code Online (Sandbox Code Playgroud)
并从JSF页面调用此方法.