Javascript 如何仅在单击按钮时将XHTML页面加载到primefaces中的对话框中?

Javascript 如何仅在单击按钮时将XHTML页面加载到primefaces中的对话框中?,javascript,jquery,jsf,jsf-2,primefaces,Javascript,Jquery,Jsf,Jsf 2,Primefaces,当按下按钮时,我需要在主界面的对话框中加载一个XHTML页面,到目前为止,我尝试的是将页面立即加载到主XHTML中,我可以使用浏览器中的view source显示该页面,我只需要在按下按钮时加载它 我尝试过的事情: <p:commandButton value="Learn More" style="float:right;" onclick="helpDialogVar.show(); return false;" /> <p:dialog id="basicDialog"

当按下按钮时,我需要在主界面的对话框中加载一个XHTML页面,到目前为止,我尝试的是将页面立即加载到主XHTML中,我可以使用浏览器中的view source显示该页面,我只需要在按下按钮时加载它

我尝试过的事情:

<p:commandButton value="Learn More" style="float:right;"
onclick="helpDialogVar.show(); return false;" />

<p:dialog id="basicDialog" header="Learn More"
    widgetVar="helpDialogVar" height="300" width="500" resizable="false"
    position="right" closable="true" closeOnEscape="true" draggable="true"
>
<ui:include src="page_to_load_inside_dialog.xhtml"    
        </p:dialog>


您应该在对话框上设置
dynamic=“true”
属性


理想情况下,您应该使用primefaces的

  <p:commandButton value="Learn More" style="float:right;"
       onclick="helpDialogVar.show(); return false;" />

 <p:dialog id="basicDialog" header="Learn More"
    widgetVar="helpDialogVar" height="300" width="500" resizable="false"
    position="right" closable="true" closeOnEscape="true" draggable="true"
    onHide="jQuery('#someId').hide();" onShow="jQuery('#someId').show();">
    <h:form prependId="false">
    <h:outputFormat escape="false">
    <iframe frameborder="0" align="left" src="page_to_load_inside_dialog.xhtml"
    name="someName" id="someId" scrolling="auto" width="750"
    height="500" marginheight="5" marginwidth="10">
</iframe>
    </h:outputFormat>
    </h:form>
</p:dialog>