我有 ap:dialog,其中 dynamic 设置为 true。在命令按钮中,我称它为显示为<p:commandButton ajax="true" actionListener="#{bean.setCurrentElement(element)}" oncomplete="myDialog.show" update=":myForm:myDialogId"/>
. 在对话框中,我有一个<p:selectOneMenu value="#{bean.currentElement.someId}
“`
当我单击命令按钮时,代码会爆炸,因为 bean.currentElement 在操作侦听器完成之前通过将其呈现为 null 来访问。当我使用<h:outputText>
时,对话框正确显示。我的对话框定义为<p:dialog header="Bla" widgetVar="myDialog" modal="true" id="myDialogId"
dynamic="true">
该 bean 是 viewScoped。为什么在调用动作侦听器方法之前呈现对话框的任何想法。?