简体   繁体   English

仅当单击按钮时,如何才能将XHTML页面加载到素面对话框中?

[英]How to load an XHTML page into a dialog in primefaces only when the button is clicked?

I need to load an XHTML page inside a dialog in prime-faces when the button is pressed, what i tried so far loads the page immediately inside the main XHTML that i could show using view source in the browser, i just need to load it only in button press. 按下按钮时,我需要在素面的对话框中加载XHTML页面,到目前为止,我尝试将页面立即加载到主要XHTML中,而我可以使用浏览器中的视图源显示该页面,我只需要加载它即可仅在按下按钮时。

Things I've tried: 我尝试过的事情:

<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>

Also using iframe: 还使用iframe:

  <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>

any other suggestions? 还有其他建议吗?

You should set the dynamic="true" attribute on the dialog. 您应该在对话框上设置dynamic="true"属性。


Ideally, you should be launching the dialog using primefaces' Dialog Framework 理想情况下,您应该使用primefaces的Dialog Framework启动对话框

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 页面加载后,按钮仅在第二次单击时才起作用 - After page load, button only works when it is clicked the second time 在“确认”对话框中单击“取消”按钮时,如何打开其他页面? - how to open a different page when cancel button is clicked in the Confirm dialog? 如何在单击按钮时从第 1 页的第 2 页加载代码? - How to load the code from page 2 on page 1 when the button is clicked? 如何在页面加载时添加一个计时器,当单击按钮时停止? - How to add a timer on page load that stops when button is clicked? JQuery对话框 - 仅在按钮单击时加载 - JQuery Dialog - only load when button click 导航到另一个页面时如何显示 Primefaces 确认对话框? - How to display a Primefaces confirm dialog when navigating to another page? 想要按钮在页面加载时隐藏内容,然后在单击按钮时显示 - Want button to hide content on page load then display when button clicked 如何使引导程序选项卡仅在单击时加载内容,而不在页面上加载 - How to make bootstrap tabs only load content when clicked, not on page load 单击按钮时如何加载新组件? - How to load a new component when button clicked? 单击按钮时如何加载jstree? - how to load jstree when a button is clicked?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM