在JSF中执行preRenderView事件后,如何显示模式对话框?

Ang*_*gel 2 dialog primefaces jsf-2

我在jsf xhtml页面中有以下内容:

<h:body>
 <ui:define name="metadata">
 <f:metadata>
  <f:viewParam name="dummy"/>
  <f:event type="preRenderView" listener="#{bean.getDataMethod}"/>
  <f:attribute name="param1" value="${param.param1}"></f:attribute>
  <f:attribute name="param2" value="${param.param2}"></f:attribute>
 </f:metadata>
 </ui:define>

 <p:dialog header="Modify" widgetVar="modDialog" height="650" width="1500" resizable="false" showEffect="explode" modal="true" draggable="false" hideEffect="explode">
  <p:panel id="modifyPanel">
   <c:if test="#{null != bean.databean}">
    <ui:include src="modifyData.xhtml"></ui:include>
   </c:if>
  </p:panel>
 </p:dialog>
</h:body>
Run Code Online (Sandbox Code Playgroud)

我需要在执行preRenderView后显示模态对话框.而且,我还需要确保所有数据都将显示在模态对话框中.

Bal*_*usC 11

只需将其visible属性设置为true.

<p:dialog ... visible="true">
Run Code Online (Sandbox Code Playgroud)

如果您打算在期间确定的条件下显示它preRenderView,那么只需将它以通常的方式绑定到布尔bean属性.

<p:dialog ... visible="#{bean.dialogVisible}">
Run Code Online (Sandbox Code Playgroud)

也可以看看: