在将大型项目从Mojarra 2.1.13升级到2.1.28时,我们注意到h:commandButton中的所有action和actionEvent方法都在为执行表单的每个ajax请求调用的页面中。我们能够使用type =“button”将问题缩小到commandButton。这些在2.1.13中运行良好,但升级后,单击一个按钮就会触发所有其他操作。
以下是用于重新创建问题的代码:
<h:form id="form">
<h:commandButton type="button" value="Action1" action="#{page1.action1}">
<f:ajax execute="@form" render="@form" />
</h:commandButton>
<h:commandButton type="button" value="Action2" action="#{page1.action2}">
<f:ajax execute="@form" render="@form" />
</h:commandButton>
<h:commandButton type="button" value="Action3" action="#{page1.action3}">
<f:ajax execute="@form" render="@form" />
</h:commandButton>
</h:form>
请注意,如果未设置按钮类型或设置为“提交”,则不会发生这种情况。看起来Mojarra 2.1.14引入了此行为。
有没有人见过这个?是否有任何考虑从这些按钮中删除type =“button”,特别是在请求生命周期(即 - 验证)方面?