【发布时间】:2017-10-09 11:03:50
【问题描述】:
我在我的应用中定义了这个链接:
<a href="${request.contextPath}/pages/help/applicationHelpVersion.jsf" title="#{msg['menu.version']}" onclick="window.open(this.href, 'applicationHelpVersion','left=20,top=20,width=400,height=300,toolbar=0,resizable=1'); return false;">#{msg['menu.version']}</a>
此解决方案使用当前应用版本号打开新的浏览器窗口。
我想重新定义它,以便打开新对话窗口。
我使用 primefaces,并且我想使用模态对话框,但在所有示例中它都与 commandButton 结合使用。
这里是 applicationHelpVersion.xhtml:
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:hr="http://java.sun.com/jsf/html"
template="/layout/helpLayout.xhtml">
<ui:define name="insert-application-content">
<div style="text-align:center">
<h1><h:outputText value="version: "/><span class="applicationVersionContent">${versionContext.productVersion}</span></h1>
<!--<h1><h:outputText value="stage: "/><span class="applicationVersionContent">${versionContext.productNameExtension}</span></h1>-->
</div>
</ui:define>
</ui:composition>
您能帮我如何使用应用程序版本打开新的模态对话框吗?我试过这样的事情:
<a href="${request.contextPath}/pages/help/applicationHelpVersion.jsf" title="#{msg['menu.version']}" onclick="PF('dlg1').show();">return false;">#{msg['menu.version']}</a>
<p:dialog header="Modal Dialog" widgetVar="dlg2" modal="true" height="100">
<h:outputText value="here will be version of app..."/>
</p:dialog>
我真的不知道在这里设置什么作为 href 参数,或者是否可以这样做。在这种状态下,应用程序版本显示在新的 .jsf 页面中,但我需要对话框窗口。你能帮我么?谢谢。
【问题讨论】:
-
你可以使用
<p:dialog visible="true" .....>
标签: jsf primefaces