Ajax Primefaces对话框未更新
我在更新primefaces对话框时遇到问题Ajax Primefaces对话框未更新,ajax,jsf,primefaces,Ajax,Jsf,Primefaces,我在更新primefaces对话框时遇到问题 <h:panelGrid columns="5" > <h:outputText value="Overrride State Date" /> <p:spacer width="5" height="5" /> <h:outputText value="Overrride End Date" />
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
目前,我正在显示一个primefaces对话框,其中包含一些可编辑格式的表单元素。
在具有更改链接的表单中,当单击更改链接时,某些输出文本字段可用。输出文本字段应以可编辑格式显示在对话框中,其中包含“接受”和“取消”按钮
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
下面是我正在使用的代码片段,我正在调用一个侦听器,在该侦听器中,我正在以可编辑格式设置对话框中要显示的属性的值,每次我都在使用的render属性更新对话框
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
render=对话框的id
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
另外,当我试图更新对话框中的内容时,我收到一些未找到的ajax错误id
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
我还尝试将对话框放在面板中,即使这不起作用
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
在这里,我使用的render属性更新对话框,但我无法更新对话框,当我刷新屏幕时,它仍然显示以前的数据。数据显示正确
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
请帮我解决这个问题
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
提前感谢。您可以尝试使用以下代码:
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
<p:dialog widgetVar="xyz" >
<p:panel id="xyzBody">
...
</p:panel>
</p:dialog>
<p:commandButton value="Open dialog" oncomplete="xyz.show()"
update="xyzBody"
actionListener="fillFieldListener" />
...
您可以尝试使用以下代码:
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
<p:dialog widgetVar="xyz" >
<p:panel id="xyzBody">
...
</p:panel>
</p:dialog>
<p:commandButton value="Open dialog" oncomplete="xyz.show()"
update="xyzBody"
actionListener="fillFieldListener" />
...
首先,您应该发布整个xhtml代码,而不仅仅是对话框内容和结束标记
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
但是我想我知道问题出在哪里:你不应该在对话框中使用render
属性,它的javascript函数show
和hide
已经足够了。另外,您应该知道,您不能更新未呈现的内容,因为在html页面(客户端/用户端)中找不到未呈现的组件。你所要做的就是:
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
<h:form>
<p:dialog id="myDialog" header="My Options" widgetVar="xyz" showEffect="fade" hideEffect="fade">
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</p:dialog>
<p:commandButton value="Update Dialog" action="#{MyBean.MyMethod}" update="MyDialog" />
</h:form>
所以你的表单应该在对话框之外,这样更好更简单;正如您所见,UpdateDialog
按钮位于对话框外部,并在运行操作方法后更新对话框(但也可以更新对话框内的面板)。
我还看到,这些接受和取消按钮只是为了测试,因为它们在没有任何服务器实现的情况下执行相同的操作…首先,您应该发布整个xhtml代码,而不仅仅是对话框内容和结束标记
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
但是我想我知道问题出在哪里:你不应该在对话框中使用render
属性,它的javascript函数show
和hide
已经足够了。另外,您应该知道,您不能更新未呈现的内容,因为在html页面(客户端/用户端)中找不到未呈现的组件。你所要做的就是:
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
<h:form>
<p:dialog id="myDialog" header="My Options" widgetVar="xyz" showEffect="fade" hideEffect="fade">
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</p:dialog>
<p:commandButton value="Update Dialog" action="#{MyBean.MyMethod}" update="MyDialog" />
</h:form>
所以你的表单应该在对话框之外,这样更好更简单;正如您所见,UpdateDialog
按钮位于对话框外部,并在运行操作方法后更新对话框(但也可以更新对话框内的面板)。
我还看到那些接受和取消按钮只是为了测试,因为它们在没有任何服务器实现的情况下执行相同的操作…您的对话框是否在
标记中
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
如果是,则检查页面的源代码或html,并验证对话框仅添加到页面一次。(您可能已将appendToBody
设置为true
)
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
我遇到了这样一个问题,对话框多次被添加到主体(可能是由于JSF的生命周期)。这将导致意外的结果,如对话框未获得更新
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
我通过删除
外部的对话框解决了这个问题,或者您可以有条件地呈现内容
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
PS:我相信您已经遵循了其他答案,比如将对话框内容包装在容器中。
正如@spauny提到的,您应该发布所有相关的xhtml代码。您的对话框是否在
标记中
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
如果是,则检查页面的源代码或html,并验证对话框仅添加到页面一次。(您可能已将appendToBody
设置为true
)
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
我遇到了这样一个问题,对话框多次被添加到主体(可能是由于JSF的生命周期)。这将导致意外的结果,如对话框未获得更新
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
我通过删除
外部的对话框解决了这个问题,或者您可以有条件地呈现内容
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
PS:我相信您已经遵循了其他答案,比如将对话框内容包装在容器中。
正如@spauny所提到的,您应该发布所有相关的xhtml代码。我看到一个结束,但不是整个画面,尽管我一直在走这条路,并为您提供了答案
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
如果窗体位于对话框外部,请尝试将其安排在对话框中。比如说,
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
<p:dialog ...>
<h:form>
...contents...
</h:form>
</p:dialog>
目录
我看到了一个结尾,但不是整个画面,尽管我一直在走这条路,并且有一个答案给你
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
如果窗体位于对话框外部,请尝试将其安排在对话框中。比如说,
<h:panelGrid columns="5" >
<h:outputText value="Overrride State Date" />
<p:spacer width="5" height="5" />
<h:outputText value="Overrride End Date" />
<p:spacer width="5" height="5" />
<h:outputText value="New Value"/>
<p:calendar value="#{certInquiry.ovrStartDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<p:calendar value="#{certInquiry.ovrEndDt}" showOn="button"/>
<p:spacer width="5" height="5" />
<h:inputText value="#{certInquiry.newVal}"/>
</h:panelGrid>
<div align="center">
<p:commandButton value="Accept"
oncomplete="xyz.hide()" /> <p:spacer width="10"
height="5" /> <p:commandButton value="Cancel"
onclick="xyz.hide()" type="reset" /></div>
</h:form>
</p:dialog>
<p:dialog ...>
<h:form>
...contents...
</h:form>
</p:dialog>
目录