Primefaces 对话框操作在初始化期间被调用
我有一个简单的 JSF 对话框,它包含在页面中,如下所示:
<ui:include src="add.xhtml"/>
在这个对话框中,我有一个
,它在没有被单击的情况下执行...
<p:dialog id="spidDialog" header="New SPID Operator" widgetVar="add">
<h:form>
<p:messages id="errorMsg" showDetail="true"/>
<h:panelGrid columns="2" id="addGrid">
<h:outputText style="font-size: smaller;" value="SPID Operator Name" />
<p:inputText id="Name" value="#{sBean.selectedName}" required="true"/>
<h:outputText style="font-size: smaller;" value="SPID Operator Code" />
<p:inputText id="Code" value="#{sBean.selectedCode}" required="true" />
</h:panelGrid>
<p:commandButton value="Save" actionListener="#{sBean.save(actionEvent)}"
oncomplete="handleDialog('spidDialog', args,add);"
update="editOperatorTabForm:Div growl editOperatorTabForm:Table"/>
<p:commandButton value="Cancel" onclick="add.hide();" immediate="true"/>
</h:form>
</p:dialog>
操作 #{ sBean.save(actionEvent)}
会导致 NullPointerException,但不应在初始化期间调用它。它是在没有任何用户交互的情况下被调用的,应该是这种情况吗?
I have a simple JSF Dialog which is included in the page like:
<ui:include src="add.xhtml"/>
In this dialog I have a <p:commandButton>
which is executed without having been clicked...
<p:dialog id="spidDialog" header="New SPID Operator" widgetVar="add">
<h:form>
<p:messages id="errorMsg" showDetail="true"/>
<h:panelGrid columns="2" id="addGrid">
<h:outputText style="font-size: smaller;" value="SPID Operator Name" />
<p:inputText id="Name" value="#{sBean.selectedName}" required="true"/>
<h:outputText style="font-size: smaller;" value="SPID Operator Code" />
<p:inputText id="Code" value="#{sBean.selectedCode}" required="true" />
</h:panelGrid>
<p:commandButton value="Save" actionListener="#{sBean.save(actionEvent)}"
oncomplete="handleDialog('spidDialog', args,add);"
update="editOperatorTabForm:Div growl editOperatorTabForm:Table"/>
<p:commandButton value="Cancel" onclick="add.hide();" immediate="true"/>
</h:form>
</p:dialog>
The action #{sBean.save(actionEvent)}
causes a NullPointerException but it should not be called during initialization. It is being called without any user interaction, should that be the case?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于
actionListener
,此表达式语法不正确。它被评估为值表达式而不是方法表达式。您需要删除(actionEvent)
部分。This expression syntax is incorrect for an
actionListener
. It is been evaluated as a value expression instead of a method expression. You need to remove the(actionEvent)
part.