Primefaces对话框架Liferay

时间:2015-03-12 15:22:25

标签: primefaces liferay dialog-framework

Primefaces Dialog Framework打开相同的portlet页面而不是必需的页面。

<p:commandButton value="Dialog" process="@this" icon="ui-icon-extlink" actionListener="#{controller.viewDialog}" />

豆:

public void viewDialog() {
    Map<String,Object> options = new HashMap<String, Object>();
    options.put("modal", true);
    options.put("draggable", false);
    options.put("resizable", true);
    options.put("contentHeight", 320);

    RequestContext.getCurrentInstance().openDialog("viewDialog", options, null);    

viewDialog.xhtml:

<f:view xmlns="http://www.w3.org/1999/xhtml"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:portlet="http://java.sun.com/portlet_2_0">
<h:head />
<h:body styleClass="jsf2-portlet">
    <f:event type="preRenderView" listener="#{dialog.initController}" />

</h:body>

2 个答案:

答案 0 :(得分:10)

如果没有,则在faces-config.xml中为“viewDialog”添加导航规则,引用viewDialog.xhtml。

<application>

    <action-listener>org.primefaces.application.DialogActionListener</action-listener>
    <navigation-handler>org.primefaces.application.DialogNavigationHandler</navigation-handler>
    <view-handler>org.primefaces.application.DialogViewHandler</view-handler>

</application>


<navigation-rule>
        <from-view-id>*</from-view-id>
        <navigation-case>
            <from-outcome>viewDialog</from-outcome>
            <to-view-id>{path}/viewDialog.xhtml</to-view-id>
        </navigation-case>
</navigation-rule>

答案 1 :(得分:4)

这是由the Liferay forum中描述的错误和问题引起的 FACES-2168

我无法仅使用经过校正的面孔 - 使用旧的生命线(6.1.1)。