RequestContext.getCurrentInstance()。openDialog()在PrimeFaces 5.1中不起作用

时间:2015-02-19 10:02:21

标签: jsf jsf-2 primefaces dialog requestcontext

我试图实现primefaces Dialog框架。但没有对话框。我使用spring webflow 2.3.2和JSF 2.1.3。

来自主机Xthml页面的代码:

<p:commandButton process="@this" ignoreAutoUpdate="true" title="#{displayManager.getFieldLabel('ADD_NEW_SITE')}"
                                        update="@this" styleClass="add_feature" actionListener="#{managePatientTO.runtimeDialog}"
                                        icon="ui-icon-plus">

Java代码:

public void runtimeDialog(ActionEvent event) {
     System.out.println("--------------------> Open Dynamic Dialog <----------------------");
     Map<String,Object> options = new HashMap<String, Object>();
        options.put("modal", true);
        options.put("draggable", false);
        options.put("resizable", false);
        options.put("contentHeight", 320);
        RequestContext.getCurrentInstance().openDialog("identifierDialog", options, null);
        FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "What we do in life", "Echoes in eternity.");

        RequestContext.getCurrentInstance().showMessageInDialog(message);

    }

虽然showMessageInDialog工作正常。

面对config.xml

<?xml version='1.0' encoding='UTF-8'?>

<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_2.xsd"
version="2.2">

<application>


    <resource-bundle>
        <base-name>app.PCMHMessages</base-name>
        <var>pcmhMessages</var>
    </resource-bundle>

    <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>identifierDialog</from-outcome>
    <to-view-id>/flows/managePatientDashboard/identifierDialog.xhtml</to-view-id>
</navigation-case>
 </navigation-rule>

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

我几乎尝试了一切。寻求帮助

0 个答案:

没有答案